DDI0406C D Armv7ar Arm PDF
DDI0406C D Armv7ar Arm PDF
DDI0406C D Armv7ar Arm PDF
Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved.
ARM DDI 0406C.d (ID040418)
ARM Architecture Reference Manual
ARMv7-A and ARMv7-R edition
Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved.
Release Information
Change History
05 April 2007 A Non-Confidential New edition for ARMv7-A and ARMv7-R architecture profiles.
Document number changed from ARM DDI 0100 to ARM DDI 0406 and contents restructured.
29 April 2008 B Non-Confidential Addition of the VFP Half-precision and Multiprocessing Extensions, and many clarifications and enhancements.
23 November 2011 C (C.a) Non-Confidential Addition of the Virtualization Extensions, Large Physical Address Extension, Generic Timer Extension, and other
additions. Many other clarifications and enhancements.
20 May 2014 C.c Non-Confidential Second errata release for issue C.a.
29 March 2018 C.d Non-Confidential Addition of CSDB instruction and some defect fixes.
Note that issue C.a, the first publication of issue C of this manual, was originally identified as issue C.
From ARMv7, the ARM® architecture defines different architectural profiles and this edition of this manual describes only the A
and R profiles. For details of the documentation of the ARMv7-M profile see Additional reading on page xxiii. Before ARMv7
there was only a single ARM Architecture Reference Manual, with document number DDI 0100. The first issue of this was in
February 1996, and the final issue, issue I, was in July 2005. For more information see Additional reading on page xxiii.
Proprietary Notice
This document is protected by copyright and other related rights and the practice or implementation of the information contained
in this document may be protected by one or more patents or pending patent applications. No part of this document may be
reproduced in any form by any means without the express prior written permission of Arm. No license, express or implied, by
estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use
the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES,
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR
PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, Arm makes no representation with respect to,
and has undertaken no analysis to identify or understand the scope and content of, patents, copyrights, trade secrets, or other rights.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES,
INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR
CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING
OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure
of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof
is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to Arm’s customers
is not intended to create or refer to any partnership relationship with any other company. Arm may make changes to this document
at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any click through or signed written
agreement covering this document with Arm, then the click through or signed written agreement prevails over and supersedes the
conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that
if there is any conflict between the English version of this document and any translation, the terms of the English version of the
Agreement shall prevail.
ii Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks of Arm Limited (or its subsidiaries)
in the US and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of
their respective owners. You must follow the Arm’s trademark usage guidelines
http://www.arm.com/company/policies/trademarks.
Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 Arm Limited (or its affiliates). All rights reserved.
LES-PRE-20349
In this document, where the term ARM is used to refer to the company it means “Arm or any of its subsidiaries as appropriate”.
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in
accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to.
Product Status
Web Address
http://www.arm.com
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. iii
ID040418 Non-Confidential
iv Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Contents
ARM Architecture Reference Manual ARMv7-A and
ARMv7-R edition
Preface
About this manual ..................................................................................................... xiv
Using this manual ...................................................................................................... xvi
Conventions .............................................................................................................. xxi
Additional reading ................................................................................................... xxiii
Feedback ................................................................................................................ xxiv
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. v
ID040418 Non-Confidential
A2.10 Thumb Execution Environment ........................................................................... A2-94
A2.11 Jazelle direct bytecode execution support .......................................................... A2-96
A2.12 Exceptions, debug events and checks .............................................................. A2-101
vi Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8.2 Standard assembler syntax fields ..................................................................... A8-285
A8.3 Conditional execution ........................................................................................ A8-286
A8.4 Shifts applied to a register ................................................................................. A8-289
A8.5 Memory accesses ............................................................................................. A8-292
A8.6 Encoding of lists of ARM core registers ............................................................ A8-293
A8.7 Additional pseudocode support for instruction descriptions .............................. A8-294
A8.8 Alphabetical list of instructions .......................................................................... A8-298
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. vii
ID040418 Non-Confidential
B3.18 Functional grouping of VMSAv7 system control registers ............................... B3-1486
B3.19 Pseudocode details of VMSA memory system operations .............................. B3-1498
viii Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
C3.5 Vector catch debug events .............................................................................. C3-2053
C3.6 Halting debug events ...................................................................................... C3-2061
C3.7 Generation of debug events ............................................................................ C3-2062
C3.8 Debug event prioritization ............................................................................... C3-2064
C3.9 Pseudocode details of Software debug events ............................................... C3-2066
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ix
ID040418 Non-Confidential
C11.9 Memory system control registers .................................................................. C11-2190
C11.10 Management registers .................................................................................. C11-2191
C11.11 Register descriptions, in register order .......................................................... C11-2197
Part D Appendixes
Appendix A Recommended External Debug Interface
D1.1 About the recommended external debug interface ......................................... D1-2324
D1.2 Authentication signals ..................................................................................... D1-2326
D1.3 Run-control and cross-triggering signals ......................................................... D1-2328
D1.4 Recommended debug slave port .................................................................... D1-2332
D1.5 Other debug signals ........................................................................................ D1-2334
Appendix D Example OS Save and Restore Sequences for External Debug Over
Powerdown
D4.1 Example OS Save and Restore sequences for v7 Debug .............................. D4-2376
D4.2 Example OS Save and Restore sequences for v7.1 Debug ........................... D4-2380
x Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
D6.7 Earlier versions of the Common VFP subarchitecture .................................... D6-2433
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xi
ID040418 Non-Confidential
D14.2 Invasive debug authentication in an implementation that supports SUHD .... D14-2567
D14.3 Effects of SUHD on Debug state ................................................................... D14-2568
Glossary
xii Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Preface
This preface introduces the ARM® Architecture Reference Manual, ARM®v7-A and ARM®v7-R edition. It contains
the following sections:
• About this manual on page xiv
• Using this manual on page xvi
• Conventions on page xxi
• Additional reading on page xxiii
• Feedback on page xxiv.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xiii
ID040418 Non-Confidential
Preface
About this manual
• The modes and states that determine how a processor operates, including the current execution privilege and
security.
• The memory model, that defines memory ordering and memory management:
— the ARMv7-A architecture profile defines a Virtual Memory System Architecture (VMSA)
— the ARMv7-R architecture profile defines a Protected Memory System Architecture (PMSA).
• The programmers’ model, and its use of a coprocessor interface to access system control registers that control
most processor and memory system features.
• The OPTIONAL Floating-point (VFP) Extension, that provides high-performance floating-point instructions
that support:
— single-precision and double-precision operations
— conversions between double-precision, single-precision, and half-precision floating-point values.
• The OPTIONAL Advanced SIMD Extension, that provides high-performance integer and single-precision
floating-point vector operations.
• The OPTIONAL Security Extensions, that facilitate the development of secure applications.
• The OPTIONAL Virtualization Extensions, that support the virtualization of Non-secure operation.
• The Debug architecture, that provides software access to debug features in the processor.
Note
ARMv7 introduces the architecture profiles. A separate Architecture Reference Manual describes the third profile,
the Microcontroller profile, ARMv7-M. For more information see Architecture versions, profiles, and variants on
page A1-30.
This manual gives the assembler syntax for the instructions it describes, meaning it can specify instructions in
textual form. However, this manual is not a tutorial for ARM assembler language, nor does it describe ARM
assembler language, except at a very basic level. To make effective use of ARM assembler language, read the
documentation supplied with the assembler being used.
Part A Describes the application level view of the architecture. It describes the application level view of
the programmers’ model and the memory model. It also describes the precise effects of each
instruction in User mode, the normal operating mode, including any restrictions on its use. This
information is of primary importance to authors and users of compilers, assemblers, and other
programs that generate ARM machine code. Software execution in User mode is at the PL0
privilege level, also described as unprivileged.
Note
User mode is the only mode where software execution is unprivileged.
xiv Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Preface
About this manual
Part B Describes the system level view of the architecture. It gives details of system registers, most of
which are not accessible from PL0, and the system level view of the memory model. It also gives
full details of the effects of instructions executed with some level of privilege, where these are
different from their effects in unprivileged execution.
Part C Describes the Debug architecture. This is an extension to the ARM architecture that provides
configuration, breakpoint and watchpoint support, and a Debug Communications Channel (DCC)
to a debug host.
Appendixes Provide additional information that is not part of the ARMv7 architectural requirements, including
descriptions of:
• features that are recommended but not required
• differences in previous versions of the architecture.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xv
ID040418 Non-Confidential
Preface
Using this manual
xvi Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Preface
Using this manual
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xvii
ID040418 Non-Confidential
Preface
Using this manual
Part D, Appendixes
This manual contains the following appendixes:
Note
This description is not part of the ARM architecture specification. It is included here as
supplementary information, for the convenience of developers and users who might require this
information.
Appendix D2 Recommended Memory-mapped and External Debug Interfaces for the Performance Monitors
Describes the recommended external interfaces to the Performance Monitors Extension.
Note
This description is not part of the ARM architecture specification. It is included here as
supplementary information, for the convenience of developers and users who might require this
information.
xviii Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Preface
Using this manual
Note
This description is not part of the ARM architecture specification. It is included here as
supplementary information, for the convenience of developers and users who might require this
information.
Appendix D4 Example OS Save and Restore Sequences for External Debug Over Powerdown
Gives software examples that perform the OS Save and Restore sequences, for v7 Debug and v7.1
Debug implementations.
Note
Chapter C7 Debug Reset and Powerdown Support describes the OS Save and Restore mechanism,
for both v7 Debug and v7.1 Debug.
Note
This description is not part of the ARM architecture specification. It is included here as
supplementary information, for the convenience of developers and users who might require this
information.
Note
This specification is not part of the ARM architecture specification. This sub-architectural
information is included here as supplementary information, for the convenience of developers and
users who might require this information.
Note
These examples are not part of the ARM architecture specification. They are included here as
supplementary information, for the convenience of developers and users who might require this
information.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xix
ID040418 Non-Confidential
Preface
Using this manual
xx Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Preface
Conventions
Conventions
The following sections describe conventions that this book can use:
• Typographic conventions
• Signals
• Numbers on page xxii
• Pseudocode descriptions on page xxii
• Assembler syntax descriptions on page xxii.
Typographic conventions
The typographic conventions are:
bold Denotes signal names, and is used for terms in descriptive lists, where appropriate.
monospace Used for assembler syntax descriptions, pseudocode, and source code examples.
Also used in the main text for instruction mnemonics and for references to other items appearing in
assembler syntax descriptions, pseudocode, and source code examples.
SMALL CAPITALS
Used in body text for a few terms that have specific technical meanings, and are defined in the
Glossary.
Note
Many links are to a register or instruction definition. Remember that:
• many system control registers are defined both in Chapter B4 System Control Registers in a
VMSA implementation and in Chapter B6 System Control Registers in a PMSA
implementation
• many instructions are defined in multiple forms, and in some cases the ARM encodings of an
instruction are defined separately to the Thumb encodings.
Ensure that any linked definition you refer to is appropriate to your context.
Signals
In general this specification does not define processor signals, but it does include some signal examples and
recommendations. The signal conventions are:
Signal level The level of an asserted signal depends on whether the signal is active-HIGH or
active-LOW. Asserted means:
• HIGH for active-HIGH signals
• LOW for active-LOW signals.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xxi
ID040418 Non-Confidential
Preface
Conventions
Numbers
Numbers are normally written in decimal. Binary numbers are preceded by 0b, and hexadecimal numbers by 0x. In
both cases, the prefix and the associated value are written in a monospace font, for example 0xFFFF0000.
Pseudocode descriptions
This manual uses a form of pseudocode to provide precise descriptions of the specified functionality. This
pseudocode is written in a monospace font, and is described in Appendix D16 Pseudocode Definition.
xxii Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Preface
Additional reading
Additional reading
This section lists relevant publications from ARM and third parties.
ARM publications
• ARM® Debug Interface v5 Architecture Specification (ARM IHI 0031).
• ARM®v7-M Architecture Reference Manual (ARM DDI 0403).
• ARM CoreSight™ Architecture Specification (ARM IHI 0029).
• ARM® Architecture Reference Manual (ARM DDI 0100I).
Note
— Issue I of the ARM Architecture Reference Manual (DDI 0100I) was issued in July 2005 and describes
the first version of the ARMv6 architecture, and all previous architecture versions.
— Addison-Wesley Professional publish ARM Architecture Reference Manual, Second Edition
(December 27, 2000). The contents of this are identical to issue E of the ARM Architecture Reference
Manual (DDI 0100E). It describes ARMv5TE and earlier versions of the ARM architecture, and is
superseded by DDI 0100I.
Other publications
The following books are referred to in this manual, or provide more information:
• IEEE Std 1596.5-1993, IEEE Standard for Shared-Data Formats Optimized for Scalable Coherent Interface
(SCI) Processors, ISBN 1-55937-354-7.
• IEEE Std 1149.1-2001, IEEE Standard Test Access Port and Boundary Scan Architecture (JTAG).
• ANSI/IEEE Std 754-2008, and ANSI/IEEE Std 754-1985, IEEE Standard for Binary Floating-Point
Arithmetic. See also Floating-point standards, and terminology on page A2-55.
• JEDEC Solid State Technology Association, Standard Manufacturer’s Identification Code, JEP106.
• Tim Lindholm and Frank Yellin, The Java Virtual Machine Specification, Second Edition, Addison Wesley,
ISBN: 0-201-43294-3.
• Kourosh Gharachorloo, Memory Consistency Models for Shared Memory-Multiprocessors, 1995, Stanford
University Technical Report CSL-TR-95-685.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. xxiii
ID040418 Non-Confidential
Preface
Feedback
Feedback
ARM welcomes feedback on its documentation.
xxiv Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Part A
Application Level Architecture
Chapter A1
Introduction to the ARM Architecture
This chapter introduces the ARM architecture and contains the following sections:
• About the ARM architecture on page A1-28.
• The instruction sets on page A1-29.
• Architecture versions, profiles, and variants on page A1-30.
• Architecture extensions on page A1-32.
• The ARM memory model on page A1-35.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A1-27
ID040418 Non-Confidential
A1 Introduction to the ARM Architecture
A1.1 About the ARM architecture
The ARM architecture is a Reduced Instruction Set Computer (RISC) architecture, as it incorporates these RISC
architecture features:
• A load/store architecture, where data-processing operations only operate on register contents, not directly on
memory contents.
• Simple addressing modes, with all load/store addresses being determined from register contents and
instruction fields only.
These enhancements to a basic RISC architecture mean ARM processors achieve a good balance of high
performance, small program size, low power consumption, and small silicon area.
This Architecture Reference Manual defines a set of behaviors to which an implementation must conform, and a set
of rules for software to use the implementation. It does not describe how to build an implementation.
Except where the architecture specifies differently, the programmer-visible behavior of an implementation must be
the same as a simple sequential execution of the program. This programmer-visible behavior does not include the
execution time of the program.
• An associated debug architecture, see Debug architecture versions on page A1-31 and Part C of this manual.
• Associated trace architectures, which define trace macrocells that implementers can implement with the
associated processor. For more information, see the ARM Embedded Trace Macrocell Architecture
Specification and the ARM CoreSight™ Program Flow Trace Architecture Specification.
A1-28 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A1 Introduction to the ARM Architecture
A1.2 The instruction sets
The Thumb instruction set was developed as a 16-bit instruction set with a subset of the functionality of the ARM
instruction set. It provides significantly improved code density, at a cost of some reduction in performance. A
processor executing Thumb instructions can change to executing ARM instructions for performance critical
segments, in particular for handling interrupts.
ARMv6T2 introduced Thumb-2 technology. This technology extends the original Thumb instruction set with many
32-bit instructions. The range of 32-bit Thumb instructions included in ARMv6T2 permits Thumb code to achieve
performance similar to ARM code, with code density better than that of earlier Thumb code.
From ARMv6T2, the ARM and Thumb instruction sets provide almost identical functionality. For more
information, see Chapter A4 The Instruction Sets.
• The architecture can provide hardware acceleration of Java bytecodes. For more information, see:
— Jazelle direct bytecode execution support on page A2-96, for application level information.
— Jazelle direct bytecode execution on page B1-1240, for system level information.
The Virtualization Extensions do not support hardware acceleration of Java bytecodes. That is, they support
only a trivial implementation of the Jazelle® extension.
• The ThumbEE instruction set is a variant of the Thumb instruction set that minimizes the code size overhead
of a Just-In-Time (JIT) or Ahead-Of-Time (AOT) compiler. JIT and AOT compilers convert execution
environment source code to a native executable. For more information, see:
— Thumb Execution Environment on page A2-94, for application level information.
— Thumb Execution Environment on page B1-1239, for system level information.
From the publication of issue C.a of this manual, ARM deprecates any use of the ThumbEE instruction set.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A1-29
ID040418 Non-Confidential
A1 Introduction to the ARM Architecture
A1.3 Architecture versions, profiles, and variants
Note
Parts A, B, and C of this Architecture Reference Manual describe the ARMv7-A and ARMv7-R profiles:
• Appendixes describe how the ARMv4-ARMv6 architecture versions differ from ARMv7.
• Separate Architecture Reference Manuals define the M-profile architectures, see Additional reading on
page xxiii.
Architecture versions can be qualified with variant letters to specify additional instructions and other functionality
that are included as an architecture extension.
Some extensions are described separately instead of using a variant letter. For details of these extensions, see
Architecture extensions on page A1-32.
ARMv4 The earliest architecture variant covered by this manual. It includes only the ARM instruction set.
ARMv5T Improves interworking of ARM and Thumb instructions. Adds Count Leading Zeros (CLZ) and
Software Breakpoint (BKPT) instructions.
ARMv5TE Enhances arithmetic support for digital signal processing (DSP) algorithms. Adds Preload Data
(PLD), Load Register Dual (LDRD), Store Register Dual (STRD), and 64-bit coprocessor register transfer
(MCRR, MRRC) instructions.
ARMv5TEJ Adds the BXJ instruction and other support for the Jazelle® architecture extension.
ARMv6 Adds many new instructions to the ARM instruction set. Formalizes and revises the memory model
and the Debug architecture.
A1-30 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A1 Introduction to the ARM Architecture
A1.3 Architecture versions, profiles, and variants
ARMv6K Adds instructions to support multiprocessing to the ARM instruction set, and some extra memory
model features.
ARMv6T2 Introduces Thumb-2 technology, that supports a major development of the Thumb instruction set to
provide a similar level of functionality to the ARM instruction set.
Note
Where appropriate, the terms ARMv6KZ or ARMv6Z describe the ARMv6K architecture with the ARMv6
Security Extensions, that were an OPTIONAL addition to the VMSAv6 architecture.
For detailed information about how earlier versions of the ARM architecture differ from ARMv7, see
Appendix D12 ARMv6 Differences and Appendix D15 ARMv4 and ARMv5 Differences.
ARMv1, ARMv2, ARMv2a, ARMv3, ARMv3G, ARMv3M, ARMv4xM, ARMv4TxM, ARMv5, ARMv5xM,
ARMv5TxM, and ARMv5TExP.
Each instruction description in this manual specifies the architecture versions that include the instruction.
v6.1 Debug Introduced to ARMv6K with the OPTIONAL Security Extensions, described in Architecture
extensions on page A1-33. A VMSAv6 implementation that includes the Security Extensions must
implement v6.1 Debug.
v7 Debug First defined in issue A of this manual, and required by any ARMv7-R implementation
An ARMv7-A implementation that does not include the Virtualization Extensions must implement
either v7 Debug or v7.1 Debug.
For more information about the Virtualization Extensions, see Architecture extensions on
page A1-33.
v7.1 Debug First defined in issue C.a of this manual, and required by any ARMv7-A implementation that
includes the Virtualization Extensions.
Note
In this manual:
• Debug usually refers to invasive debug, that permits modification of the state of the processor.
• Trace usually refers to non-invasive debug, that does not permit modification of the state of the processor.
For more information, see About the ARM Debug architecture on page C1-2009.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A1-31
ID040418 Non-Confidential
A1 Introduction to the ARM Architecture
A1.4 Architecture extensions
Jazelle Is the Java bytecode execution extension that extended ARMv5TE to ARMv5TEJ. From
ARMv6, the architecture requires at least the trivial Jazelle implementation, but a Jazelle
implementation is still often described as a Jazelle extension.
The Virtualization Extensions require that the Jazelle implementation is the trivial Jazelle
implementation.
ThumbEE Is an extension that provides the ThumbEE instruction set, a variant of the Thumb
instruction set that is designed as a target for dynamically generated code. In the original
release of the ARMv7 architecture, the ThumbEE extension was:
• A required extension to the ARMv7-A profile.
• An optional extension to the ARMv7-R profile.
From publication of issue C.a of this manual, ARM deprecates any use of ThumbEE
instructions. However, ARMv7-A implementations must continue to include ThumbEE
support, for backwards compatibility.
Floating-point Is a floating-point coprocessor extension to the instruction set architectures. For historic
reasons, the Floating-point Extension is also called the VFP Extension. There have been the
following versions of the Floating-point (VFP) Extension:
VFPv1 Obsolete. Details are available on request from ARM.
VFPv2 An optional extension to:
• The ARM instruction set in the ARMv5TE, ARMv5TEJ, ARMv6, and
ARMv6K architectures.
• The ARM and Thumb instruction sets in the ARMv6T2 architecture.
VFPv3 An OPTIONAL extension to the ARM, Thumb, and ThumbEE instruction sets in
the ARMv7-A and ARMv7-R profiles.
VFPv3 can be implemented with either 32 or 16 doubleword registers, as
described in Advanced SIMD and Floating-point Extension registers on
page A2-56. Where necessary, the terms VFPv3-D32 and
VFPv3-D16distinguish between these two implementation options. Where the
term VFPv3 is used it covers both options.
VFPv3U is a variant of VFPv3 that supports the trapping of floating-point
exceptions to support code, see VFPv3U and VFPv4U on page A2-61.
VFPv3 with Half-precision Extension
VFPv3 and VFPv3U can be extended by the OPTIONAL Half-precision
Extension, that provides conversion functions in both directions between
half-precision floating-point and single-precision floating-point.
VFPv4 An OPTIONAL extension to the ARM, Thumb, and ThumbEE instruction sets in
the ARMv7-A and ARMv7-R profiles.
VFPv4U is a variant of VFPv4 that supports the trapping of floating-point
exceptions to support code, see VFPv3U and VFPv4U on page A2-61.
A1-32 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A1 Introduction to the ARM Architecture
A1.4 Architecture extensions
VFPv4 and VFPv4U add both the Half-precision Extension and the fused
multiply-add instructions to the features of VFPv3. VFPv4 can be implemented
with either 32 or 16 doubleword registers, see Advanced SIMD and
Floating-point Extension registers on page A2-56. Where necessary, these
implementation options are distinguished using the terms:
• VFPv4-D32, or VFPv4U-D32, for a 32 register implementation.
• VFPv4-D16, or VFPv4U-D16, for a 16 register implementation.
Where the term VFPv4 is used it covers both options.
If an implementation includes both the Floating-point and Advanced SIMD Extensions:
• It must implement the corresponding versions of the extensions:
— If the implementation includes VFPv3 it must include Advanced SIMDv1.
— If the implementation includes VFPv3 with the Half-precision Extension it
must include Advanced SIMDv1 with the half-precision extensions.
— If the implementation includes VFPv4 it must include Advanced SIMDv2.
• The two extensions use the same register bank. This means VFP must be
implemented as VFPv3-D32, or as VFPv4-D32.
• Some instructions apply to both extensions.
Advanced SIMD Is an instruction set extension that provides Single Instruction Multiple Data (SIMD)
integer and single-precision floating-point vector operations on doubleword and quadword
registers. There have been the following versions of Advanced SIMD:
Advanced SIMDv1
It is an OPTIONAL extension to the ARMv7-A and ARMv7-R profiles.
Advanced SIMDv1 with Half-precision Extension
Advanced SIMDv1 can be extended by the OPTIONAL Half-precision Extension,
that provides conversion functions in both directions between half-precision
floating-point and single-precision floating-point.
Advanced SIMDv2
It is an OPTIONAL extension to the ARMv7-A and ARMv7-R profiles.
Advanced SIMDv2 adds both the Half-precision Extension and the fused
multiply-add instructions to the features of Advanced SIMDv1.
See the description of the Floating-point Extension for more information about
implementations that include both the Floating-point Extension and the Advanced SIMD
Extension.
Security Extensions
Are an OPTIONAL SET OF extensions to VMSAv6 implementations of the ARMv6K architecture, and
to the ARMv7-A architecture profile, that provide a set of security features that facilitate the
development of secure applications.
Multiprocessing Extensions
Are an OPTIONAL SET OF extensions to the ARMv7-A and ARMv7-R profiles, that provides a set of
features that enhance multiprocessing functionality.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A1-33
ID040418 Non-Confidential
A1 Introduction to the ARM Architecture
A1.4 Architecture extensions
Virtualization Extensions
Are an OPTIONAL set of extensions to VMSAv7 that provides hardware support for virtualizing the
Non-secure state of a VMSAv7 implementation. This supports system use of a virtual machine
monitor, also called a hypervisor, to switch Guest operating systems.
The Virtualization Extensions require implementation of:
• The Security Extensions.
• The Large Physical Address Extension.
• The v7.1 Debug architecture, see Scope of part C of this manual on page C1-2008.
If an implementation that includes the Virtualization Extensions also implements:
• The Performance Monitors Extension, then it must implement version 2 of that extension,
PMUv2, see About the Performance Monitors on page C12-2288.
• A trace macrocell, that trace macrocell must support the Virtualization Extensions. In
particular, if the trace macrocell is:
— An Embedded Trace Macrocell (ETM), the macrocell must implement ETMv3.5 or
later, see the Embedded Trace Macrocell Architecture Specification.
— A Program Trace Macrocell (PTM), the macrocell must implement PFTv1.1 or later,
see the CoreSight Program Flow Trace Architecture Specification.
In some tables in this manual, an ARMv7-A implementation that includes the Virtualization
Extensions is described as ARMv7VE, or as v7VE.
Note
The Fast Context Switch Extension (FCSE) is an older ARM extension, described in Appendix D10:
• ARM deprecates any use of this extension. This means in ARMv7 implementations before the introduction
of the Multiprocessing Extensions, the FCSE is OPTIONAL and deprecated.
• The Multiprocessing Extensions obsolete the FCSE. This means that any processor that includes the
Multiprocessing Extensions cannot include the FCSE. This includes all processors that implement the Large
Physical Address Extension.
A1-34 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A1 Introduction to the ARM Architecture
A1.5 The ARM memory model
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A1-35
ID040418 Non-Confidential
A1 Introduction to the ARM Architecture
A1.5 The ARM memory model
A1-36 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A2
Application Level Programmers’ Model
This chapter gives an application level view of the ARM programmers’ model. It contains the following sections:
• About the Application level programmers’ model on page A2-38.
• ARM core data types and arithmetic on page A2-40.
• ARM core registers on page A2-45.
• The Application Program Status Register (APSR) on page A2-49.
• Execution state registers on page A2-50.
• Advanced SIMD and Floating-point Extensions on page A2-54.
• Floating-point data types and arithmetic on page A2-62.
• Polynomial arithmetic over {0, 1} on page A2-92.
• Coprocessor support on page A2-93.
• Thumb Execution Environment on page A2-94.
• Jazelle direct bytecode execution support on page A2-96.
• Exceptions, debug events and checks on page A2-101.
Note
In this chapter, system register names usually link to the description of the register in Chapter B4 System Control
Registers in a VMSA implementation, for example FPSCR. If the register is included in a PMSA implementation,
then it is also described in Chapter B6 System Control Registers in a PMSA implementation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-37
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.1 About the Application level programmers’ model
The information in this chapter is distinct from the system information required to service and support application
execution under an operating system, or higher level of system software. However, some knowledge of that system
information is needed to put the Application level programmers' model into context.
Depending on the implemented architecture extensions, the architecture supports multiple levels of execution
privilege, that number upwards from PL0, where PL0 is the lowest privilege level and is often described as
unprivileged. The Application level programmers’ model is the programmers’ model for software executing at PL0.
For more information see Processor privilege levels, execution privilege, and access privilege on page A3-139.
System software determines the privilege level at which application software runs. When an operating system
supports execution at both PL1 and PL0, an application usually runs unprivileged. This:
• Permits the operating system to allocate system resources to an application in a unique or shared manner.
• Provides a degree of protection from other processes and tasks, and so helps protect the operating system
from malfunctioning applications.
This chapter indicates where some system level understanding is helpful, and if appropriate it gives a reference to
the system level description in Chapter B1 System Level Programmers’ Model, or elsewhere.
The Security Extensions extend the architecture to provide hardware security features that support the development
of secure applications, by providing two Security states. The Virtualization Extensions further extend the
architecture to provide virtualization of operation in Non-secure state. However, application level software is
generally unaware of these extensions. For more information, see The Security Extensions on page B1-1156 and The
Virtualization Extensions on page B1-1161.
Note
• When an implementation includes the Security Extensions, application and operating system software
normally executes in Non-secure state.
• The virtualization features accessible only at PL2 are implemented only in Non-secure state. Secure state has
only two privilege levels, PL0 and PL1.
• Older documentation, describing implementations or architecture versions that support only two privilege
levels, often refers to execution at PL1 as privileged execution.
• In this manual, the following terms have special meanings, defined in the Glossary:
— IMPLEMENTATION DEFINED, see IMPLEMENTATION DEFINED.
— OPTIONAL, see OPTIONAL.
— SUBARCHITECTURE DEFINED, see SUBARCHITECTURE DEFINED.
— UNDEFINED, see UNDEFINED.
— UNKNOWN, see UNKNOWN.
— UNPREDICTABLE, see UNPREDICTABLE.
A2-38 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.1 About the Application level programmers’ model
Floating-point and vector instructions operate on an independent register file, described in Advanced SIMD and
Floating-point Extension registers on page A2-56. In an implementation that includes both of these extensions, they
share a common register file. The following sections give more information about these extensions and the
instructions they provide:
• Advanced SIMD and Floating-point Extensions on page A2-54.
• Floating-point data types and arithmetic on page A2-62.
• Polynomial arithmetic over {0, 1} on page A2-92.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-39
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.2 ARM core data types and arithmetic
Processor registers are 32 bits in size. The instruction set contains instructions supporting the following data types
held in registers:
• 32-bit pointers.
• Unsigned or signed 32-bit integers.
• Unsigned 16-bit or 8-bit integers, held in zero-extended form.
• Signed 16-bit or 8-bit integers, held in sign-extended form.
• Two 16-bit integers packed into a register.
• Four 8-bit integers packed into a register.
• Unsigned or signed 64-bit integers held in two registers.
Load and store operations can transfer bytes, halfwords, or words to and from memory. Loads of bytes or halfwords
zero-extend or sign-extend the data as it is loaded, as specified in the appropriate load instruction.
The instruction sets include load and store operations that transfer two or more words to and from memory. Software
can load and store doublewords using these instructions.
Note
For information about the atomicity of memory accesses see Atomicity in the ARM architecture on page A3-125.
When any of the data types is described as unsigned, the N-bit data value represents a non-negative integer in the
range 0 to 2N-1, using normal binary format.
When any of these types is described as signed, the N-bit data value represents an integer in the range -2N-1 to
+2N-1-1, using two's complement format.
The instructions that operate on packed halfwords or bytes include some multiply instructions that use just one of
two halfwords, and SIMD instructions that perform parallel addition or subtraction on all of the halfwords or bytes.
Direct instruction support for 64-bit integers is limited, and most 64-bit operations require sequences of two or more
instructions to synthesize them.
A2-40 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.2 ARM core data types and arithmetic
• By direct use of the pseudocode operators and built-in functions defined in Operators and built-in functions
on page D16-2637.
• By use of pseudocode helper functions defined in the main text. These can be located using the table in
Appendix D17 Pseudocode Index.
Rotate Right (ROR) moves each bit of a bitstring right by a specified number of bits. Each bit that is shifted off the
right end of the bitstring is re-introduced at the left end. The last bit shifted off the right end of the
bitstring can be produced as a carry output.
These shift and rotate operations are supported in pseudocode by the following functions:
// LSL_C()
// =======
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-41
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.2 ARM core data types and arithmetic
// LSL()
// =====
// LSR_C()
// =======
// LSR()
// =====
// ASR_C()
// =======
// ASR()
// =====
// ROR_C()
// =======
// ROR()
// =====
A2-42 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.2 ARM core data types and arithmetic
// RRX_C()
// =======
// RRX()
// =====
The main addition and subtraction instructions can produce status information about both unsigned carry and signed
overflow conditions. When necessary, multi-word additions and subtractions are synthesized from this status
information. In pseudocode the AddWithCarry() function provides an addition with a carry input and carry and
overflow outputs:
// AddWithCarry()
// ==============
then:
• If carry_in == '1', then result == x-y with:
— overflow == '1' if signed overflow occurred during the subtraction.
— carry_out == '1' if unsigned borrow did not occur during the subtraction, that is, if x >= y.
• If carry_in == '0', then result == x-y-1 with:
— overflow == '1' if signed overflow occurred during the subtraction.
— carry_out == '1' if unsigned borrow did not occur during the subtraction, that is, if x > y.
Together, these mean that the carry_in and carry_out bits in AddWithCarry() calls can act as NOT borrow flags for
subtractions as well as carry flags for additions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-43
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.2 ARM core data types and arithmetic
• The SignedSatQ() and UnsignedSatQ() functions when an operation requires, in addition to the saturated
result, a Boolean argument that indicates whether saturation occurred.
• The SignedSat() and UnsignedSat() functions when only the saturated result is required.
// SignedSatQ()
// ============
// UnsignedSatQ()
// ==============
// SignedSat()
// ===========
// UnsignedSat()
// =============
SatQ(i, N, unsigned) returns either UnsignedSatQ(i, N) or SignedSatQ(i, N) depending on the value of its third
argument, and Sat(i, N, unsigned) returns either UnsignedSat(i, N) or SignedSat(i, N) depending on the value of
its third argument:
// SatQ()
// ======
// Sat()
// =====
A2-44 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.3 ARM core registers
Note
Using SP for any purpose other than as a stack pointer is likely to break the requirements of
operating systems, debuggers, and other software systems, causing them to malfunction.
See ARM core registers on page B1-1143 for the system level view of these registers.
Note
In general, ARM strongly recommends using the names SP, LR and PC instead of R13, R14 and R15. However,
sometimes it is simpler to use the R13-R15 names when referring to a group of registers. For example, it is simpler
to refer to Registers R8 to R15, rather than to Registers R8 to R12, the SP, LR and PC. These two descriptions of the
group of registers have exactly the same meaning.
• In Thumb state, the following 16-bit Thumb instruction encodings branch to the value written to the PC:
— Encoding T2 of ADD (register, Thumb) on page A8-308.
— Encoding T1 of MOV (register, Thumb) on page A8-487.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-45
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.3 ARM core registers
The value written to the PC is forced to be halfword-aligned by ignoring its least significant bit, treating that
bit as being 0.
• The B, BL, CBNZ, CBZ, CHKA, HB, HBL, HBLP, HBP, TBB, and TBH instructions remain in the same instruction set state
and branch to the value written to the PC.
The definition of each of these instructions ensures that the value written to the PC is correctly aligned for
the current instruction set state.
• The BLX (immediate) instruction switches between ARM and Thumb states and branches to the value written
to the PC. Its definition ensures that the value written to the PC is correctly aligned for the new instruction
set state.
• The following instructions write a value to the PC, treating that value as an interworking address to branch
to, with low-order bits that determine the new instruction set state:
— BLX (register), BX, and BXJ.
— LDR instructions with <Rt> equal to the PC.
— POP and all forms of LDM except LDM (exception return), when the register list includes the PC.
— In ARM state only, ADC, ADD, ADR, AND, ASR (immediate), BIC, EOR, LSL (immediate), LSR (immediate), MOV,
MVN, ORR, ROR (immediate), RRX, RSB, RSC, SBC, and SUB instructions with <Rd> equal to the PC and without
flag-setting specified.
For details of how an interworking address specifies the new instruction set state and instruction address, see
Pseudocode details of operations on ARM core registers.
Note
— The register-shifted register instructions, that are available only in the ARM instruction set and are
summarized inData-processing (register-shifted register) on page A5-195, cannot write to the PC.
— The LDR, POP, and LDM instructions first have interworking branch behavior in ARMv5T.
— The instructions listed as having interworking branch behavior in ARM state only first have this
behavior in ARMv7.
In the cases where later versions of the architecture introduce interworking branch behavior, the behavior in
earlier architecture versions is a branch that remains in the same instruction set state. For more information,
see:
— Interworking on page D12-2489, for ARMv6.
— Interworking on page D15-2575, for ARMv5 and ARMv4.
• Some instructions are treated as exception return instructions, and write both the PC and the CPSR. For more
information, including which instructions are exception return instructions, see Exception return on
page B1-1193.
• Some instructions cause an exception, and the exception handler address is written to the PC as part of the
exception entry. Similarly, in ThumbEE state, an instruction that fails its null check causes the address of the
null check handler to be written to the PC, see Null checking on page A9-1113.
bits(32) R[integer n]
assert n >= 0 && n <= 15;
A2-46 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.3 ARM core registers
Pseudocode details of ARM core register operations on page B1-1144 explains the full operation of this function.
Descriptions of ARM store instructions that store the PC value use the PCStoreValue() pseudocode function to
specify the PC value stored by the instruction:
// PCStoreValue()
// ==============
bits(32) PCStoreValue()
// This function returns the PC value. On architecture versions before ARMv7, it
// is permitted to instead return PC+4, provided it does so consistently. It is
// used only to describe ARM instructions, so it returns the address of the current
// instruction plus 8 (normally) or 12 (when the alternative is permitted).
return PC;
Writing an address to the PC causes either a simple branch to that address or an interworking branch that also selects
the instruction set to execute after the branch. A simple branch is performed by the BranchWritePC() function:
// BranchWritePC()
// ===============
BranchWritePC(bits(32) address)
if CurrentInstrSet() == InstrSet_ARM then
if ArchVersion() < 6 && address<1:0> != '00' then UNPREDICTABLE;
BranchTo(address<31:2>:'00');
elsif CurrentInstrSet() == InstrSet_Jazelle then
if JazelleAcceptsExecution() then
BranchTo(address<31:0>);
else
newaddress = address;
newaddress<1:0> = bits(2) UNKNOWN;
BranchTo(newaddress);
else
BranchTo(address<31:1>:'0');
// BXWritePC()
// ===========
BXWritePC(bits(32) address)
if CurrentInstrSet() == InstrSet_ThumbEE then
if address<0> == '1' then
BranchTo(address<31:1>:'0'); // Remaining in ThumbEE state
else
UNPREDICTABLE;
else
if address<0> == '1' then
SelectInstrSet(InstrSet_Thumb);
BranchTo(address<31:1>:'0');
elsif address<1> == '0' then
SelectInstrSet(InstrSet_ARM);
BranchTo(address);
else // address<1:0> == '10'
UNPREDICTABLE;
The LoadWritePC() and ALUWritePC() functions are used for two cases where the behavior was systematically
modified between architecture versions:
// LoadWritePC()
// =============
LoadWritePC(bits(32) address)
if ArchVersion() >= 5 then
BXWritePC(address);
else
BranchWritePC(address);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-47
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.3 ARM core registers
// ALUWritePC()
// ============
ALUWritePC(bits(32) address)
if ArchVersion() >= 7 && CurrentInstrSet() == InstrSet_ARM then
BXWritePC(address);
else
BranchWritePC(address);
Note
The behavior of the PC writes performed by the ALUWritePC() function is different in Debug state, where there are
more UNPREDICTABLE cases. The pseudocode in this section only handles the non-debug cases. For more
information, see Behavior of Data-processing instructions that access the PC in Debug state on page C5-2088.
A2-48 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.4 The Application Program Status Register (APSR)
• Reserved bits, that are allocated to system features, or are available for future expansion. Unprivileged
execution ignores writes to fields that are accessible only at PL1 or higher. However, application level
software that writes to the APSR must treat reserved bits as Do-Not-Modify (DNM) bits. For more
information about the reserved bits, see Format of the CPSR and SPSRs on page B1-1148.
Although bits[15:0] are UNKNOWN on reads, it is permitted that, on a read of APSR:
— Bit[9] returns the value of CPSR.E.
— Bits[8:6] return the value of CPSR.{A,I, F}, the mask bits.
This is an exception to the general rule that an UNKNOWN field must not return information that cannot be
obtained, at the current Privilege level, by an architected mechanism.
ARM recommends that these bits do not return the CPSR bit values on a read of the APSR.
• Bits[26:24] are RAZ/SBZP. Therefore, software can use MSR instructions that write the top byte of the APSR
without using a read, modify, write sequence. If it does this, it must write zeros to bits[26:24].
Instructions can test the N, Z, C, and V condition flags, combining these with the condition code for the instruction
to determine whether the instruction must be executed. In this way, execution of the instruction is conditional on the
result of a previous operation. For more information about conditional execution, see Conditional execution on
page A4-159 and Conditional execution on page A8-286.
In ARMv7-A and ARMv7-R, the APSR is the same register as the CPSR, but the APSR must be used only to access
the N, Z, C, V, Q, and GE[3:0] bits. For more information, see Program Status Registers (PSRs) on page B1-1147.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-49
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.5 Execution state registers
• Whether instructions are interpreted as Thumb instructions, ARM instructions, ThumbEE instructions, or
Java bytecodes. For more information, see Instruction set state register, ISETSTATE.
• In Thumb state and ThumbEE state only, the condition codes that apply to the next one to four instructions.
For more information, see IT block state register, ITSTATE on page A2-51.
• Whether data is interpreted as big-endian or little-endian. For more information, see Endianness mapping
register, ENDIANSTATE on page A2-53.
In ARMv7-A and ARMv7-R, the execution state registers are part of the Current Program Status Register. For more
information, see Program Status Registers (PSRs) on page B1-1147.
There is no direct access to the execution state registers from application level instructions, but they can be changed
by side-effects of application level instructions.
J T
The J bit and the T bit determine the current instruction set state for the processor. Table A2-1 shows the encoding
of these bits.
0 0 ARM
0 1 Thumb
1 0 Jazelle
1 1 ThumbEE
ARM state The processor executes the ARM instruction set described in Chapter A5 ARM Instruction
Set Encoding.
Thumb state The processor executes the Thumb instruction set as described in Chapter A6 Thumb
Instruction Set Encoding.
Jazelle state The processor executes Java bytecodes as part of a Java Virtual Machine (JVM). For more
information, see:
• Jazelle direct bytecode execution support on page A2-96, for application level
information.
• Jazelle direct bytecode execution on page B1-1240, for system level information.
ThumbEE state The processor executes a variation of the Thumb instruction set specifically targeted for use
with dynamic compilation techniques associated with an execution environment. This can
be Java or other execution environments. This feature is required in ARMv7-A, and optional
in ARMv7-R. For more information, see:
• Thumb Execution Environment on page A2-94, for application level information.
• Thumb Execution Environment on page B1-1239, for system level information.
A2-50 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.5 Execution state registers
// CurrentInstrSet()
// =================
InstrSet CurrentInstrSet()
case ISETSTATE of
when '00' result = InstrSet_ARM;
when '01' result = InstrSet_Thumb;
when '10' result = InstrSet_Jazelle;
when '11' result = InstrSet_ThumbEE;
return result;
// SelectInstrSet()
// ================
SelectInstrSet(InstrSet iset)
case iset of
when InstrSet_ARM
if CurrentInstrSet() == InstrSet_ThumbEE then
UNPREDICTABLE;
else
ISETSTATE = '00';
when InstrSet_Thumb
ISETSTATE = '01';
when InstrSet_Jazelle
ISETSTATE = '10';
when InstrSet_ThumbEE
ISETSTATE = '11';
return;
IT[7:0]
This field holds the If-Then execution state bits for the Thumb IT instruction, that applies to the IT block of one to
four instructions that immediately follow the IT instruction. See IT on page A8-391 for a description of the IT
instruction and the associated IT block.
IT[7:5] Holds the base condition for the current IT block. The base condition is the top 3 bits of the
condition code specified by the <firstcond> field of the IT instruction.
This subfield is 0b000 when no IT block is active.
IT[4:0] Encodes:
• The size of the IT block. This is the number of instructions that are to be conditionally
executed. The size of the block is implied by the position of the least significant 1 in this field,
as shown in Table A2-2 on page A2-52.
• The value of the least significant bit of the condition code for each instruction in the block.
Note
Changing the value of the least significant bit of a condition code from 0 to 1 has the effect
of inverting the condition code.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-51
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.5 Execution state registers
When an IT instruction is executed, these bits are set according to the <firstcond> condition code in the instruction,
and the Then and Else (T and E) parameters in the instruction. For more information, see IT on page A8-391.
When permitted, an instruction in an IT block is conditional, see Conditional instructions on page A4-160 and
Conditional execution on page A8-286. The condition code used is the current value of IT[7:4]. When an instruction
in an IT block completes its execution normally, ITSTATE advances to the next line of Table A2-2. A few instructions,
for example BKPT, cannot be conditional and therefore are always executed, ignoring the current ITSTATE.
An instruction that might complete its normal execution by branching is only permitted in an IT block as the last
instruction in the block. This means that normal execution of the instruction always results in ITSTATE advancing to
normal execution.
IT bits a
Note
[7:5] [4] [3] [2] [1] [0]
On a branch or an exception return, if ITSTATE is set to a value that is not consistent with the instruction stream
being branched to or returned to, then instruction execution is UNPREDICTABLE.
ITSTATE affects instruction execution only in Thumb and ThumbEE states. In ARM and Jazelle states, ITSTATE must
be '00000000', otherwise the behavior is UNPREDICTABLE.
// ITAdvance()
// ===========
ITAdvance()
if ITSTATE<2:0> == '000' then
ITSTATE.IT = '00000000';
else
ITSTATE.IT<4:0> = LSL(ITSTATE.IT<4:0>, 1);
The following functions test whether the current instruction is in an IT block, and whether it is the last instruction
of an IT block:
// InITBlock()
// ===========
boolean InITBlock()
return (ITSTATE.IT<3:0> != '0000');
A2-52 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.5 Execution state registers
// LastInITBlock()
// ===============
boolean LastInITBlock()
return (ITSTATE.IT<3:0> == '1000');
0 Little-endian
1 Big-endian
The ARM and Thumb instruction sets both include an instruction to manipulate ENDIANSTATE:
SETEND BE Sets ENDIANSTATE to 1, for big-endian operation.
SETEND LE Sets ENDIANSTATE to 0, for little-endian operation.
The SETEND instruction is unconditional. For more information, see SETEND on page A8-605.
// BigEndian()
// ===========
boolean BigEndian()
return (ENDIANSTATE == '1');
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-53
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
The Advanced SIMD Extension performs packed Single Instruction Multiple Data (SIMD) operations, either
integer or single-precision floating-point. The Floating-point Extension performs single-precision or
double-precision floating-point operations.
Both extensions permit floating-point exceptions, such as overflow or division by zero, to be handled without
trapping. When handled in this way, a floating-point exception causes a cumulative status register bit to be set to 1
and a default result to be produced by the operation.
The ARMv7 Floating-point Extension implementation can be VFPv3 or VFPv4, see Architecture extensions on
page A1-32. ARMv7 also defines variants of VFPv3 and VFPv4, VFPv3U and VFPv4U, that support the trapping
of floating-point exceptions, see VFPv3U and VFPv4U on page A2-61. VFPv2 also supports the trapping of
floating-point exceptions.
If an implementation includes both the Advanced SIMD and the Floating-point Extensions then the versions of the
two extensions must align, as described in Instruction set architecture extensions on page A1-32.
For more information about floating-point exceptions see Floating-point exceptions on page A2-69.
Each version of these extensions can be implemented at a number of levels. Table A2-4 shows the permitted
combinations of implementations of the two extensions.
a. Must be able to load and store double-precision data using the bottom 16 double-precision registers, D0-D15.
The Half-precision Extension provides conversion functions in both directions between half-precision
floating-point and single-precision floating-point. This extension:
• Can be implemented with any Advanced SIMDv1 or VFPv3 implementation that supports single-precision
floating-point, and the Half-precision extension applies to both VFP and Advanced SIMD if they are both
implemented.
For system level information about the Advanced SIMD and Floating-point Extensions see Advanced SIMD and
floating-point support on page B1-1228.
A2-54 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
Note
Before ARMv7, the Floating-point Extension was called the Vector Floating-point Architecture, and was used for
vector operations. For details of these deprecated operations see Appendix D11 VFP Vector Operation Support. In
ARMv7:
• ARM recommends that the Advanced SIMD Extension is used for single-precision vector floating-point
operations.
• An implementation that requires support for vector operations must implement the Advanced SIMD
Extension.
• Floating-point terminology generally uses the IEEE 754-1985 terms. This section summarizes how
IEEE 754-2008 changes these terms.
• References to IEEE 754 that do not include the issue year apply to either issue of the standard.
Table A2-5 shows how the terminology in this manual differs from that used in IEEE 754-2008.
Normalized Normal
The fused multiply add operations are first defined in IEEE 754-2008, and are introduced in VFPv4 and
Advanced SIMDv2. The following sections describe the instructions that perform these operations:
• VFMA, VFMS on page A8-893.
• VFNMA, VFNMS on page A8-895.
All other ARMv7 floating-point operations are defined in both issues of IEEE 754.
Note
ARMv7 does not support the IEEE 754-2008 roundTiesToAway rounding mode. However, IEEE 754-compliance
does not require support for this mode.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-55
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
• If VFPv3 is implemented, it consists of either 32 or 16 doubleword registers. Where necessary, these two
implementation options are distinguished using the terms:
— VFPv3-D32, for an implementation with 32 doubleword registers.
— VFPv3-D16, for an implementation with 16 doubleword registers.
• If VFPv4 is implemented, it consists of either 32 or 16 doubleword registers. Where necessary, these two
implementation options are distinguished using the terms:
— VFPv4-D32, for an implementation with 32 doubleword registers.
— VFPv4-D16, for an implementation with 16 doubleword registers.
• If Advanced SIMD and Floating-point are both implemented, Floating-point must be implemented as
VFPv3-D32 or VFPv4-D32.
The Advanced SIMD and Floating-point views of the extension register set are not identical. The following sections
describe these different views.
Figure A2-1 on page A2-57 shows the views of the extension register set, and the way the word, doubleword, and
quadword registers overlap.
A2-56 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
S28
D14 D14
S29
Q7
S30
D15 D15
S31
D16
Q8
D17
D30
Q15
D31
For example, software can access the least significant half of the elements of a vector in Q6 by referring to D12, and
the most significant half of the elements by referring to D13.
boolean VFPSmallRegisterBank()
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-57
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
The following functions provide the S0-S31, D0-D31, and Q0-Q15 views of the registers:
// The 64-bit extension register bank for Advanced SIMD and VFP.
// Clone the 64-bit Advanced SIMD and VFP extension register bank for use as input to
// instruction pseudocode, to avoid read-after-write for Advanced SIMD and VFP operations.
bits(32) S[integer n]
assert n >= 0 && n <= 31;
if (n MOD 2) == 0 then
result = D[n DIV 2]<31:0>;
else
result = D[n DIV 2]<63:32>;
return result;
bits(64) D[integer n]
assert n >= 0 && n <= 31;
if n >= 16 && VFPSmallRegisterBank() then UNDEFINED;
return _D[n];
bits(128) Q[integer n]
assert n >= 0 && n <= 15;
return D[2*n+1]:D[2*n];
The Din[] function returns a Doubleword register from the _Dclone[] copy of the Advanced SIMD and
Floating-point register bank, and the Qin[] function returns a Quadword register from that register bank.
A2-58 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
Note
The CheckAdvancedSIMDEnabled() function copies the _D[] register bank to _Dclone[], see Pseudocode details of
enabling the Advanced SIMD and Floating-point Extensions on page B1-1234.
bits(64) Din[integer n]
assert n >= 0 && n <= 31;
if n >= 16 && VFPSmallRegisterBank() then UNDEFINED;
return _Dclone[n];
bits(128) Qin[integer n]
assert n >= 0 && n <= 15;
return Din[2*n+1]:Din[2*n];
Polynomial arithmetic over {0, 1} on page A2-92 describes the polynomial data type.
The .F16 data type is the half-precision data type selected by the FPSCR.AHP bit. It is supported only if an
implementation includes the Half-precision extension.
The .F32 data type is the ARM standard single-precision floating-point data type, see Advanced SIMD and
Floating-point single-precision format on page A2-63.
The instruction definitions use a data type specifier to define the data types appropriate to the operation. Figure A2-2
on page A2-60 shows the hierarchy of Advanced SIMD data types.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-59
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
.S8
.I8
.U8
.8
.P8
-
.S16
.I16
.U16
.16
.P16 †
.F16 ‡
.S32
.I32
.U32
.32
-
.F32
.S64
.I64
.U64
.64
-
-
† Output format only. See VMULL instruction description.
‡ Supported only if the implementation includes the Half-precision Extension.
For example, a multiply instruction must distinguish between integer and floating-point data types.
An integer multiply instruction that generates a double-width (long) result must specify the input data types as
signed or unsigned. However, some integer multiply instructions use modulo arithmetic, and therefore do not have
to distinguish between signed and unsigned inputs.
Vector indices are in the range 0 to (number of elements – 1). An index of 0 refers to the least significant end of the
vector. Figure A2-3 shows examples of Advanced SIMD vectors:
Qn
128-bit vector of 16-bit signed integers .S16 .S16 .S16 .S16 .S16 .S16 .S16 .S16
[7] [6] [5] [4] [3] [2] [1] [0]
63 48 47 32 31 16 15 0
Dn
A2-60 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.6 Advanced SIMD and Floating-point Extensions
Note
In this chapter, short links to the FPSCR are to the description in Chapter B4 System Control Registers in a VMSA
implementation. The FPSCR description in Chapter B6 System Control Registers in a PMSA implementation is
identical to this description.
Writes to the FPSCR can have side-effects on various aspects of processor operation. All of these side-effects are
synchronous to the FPSCR write. This means they are guaranteed not to be visible to earlier instructions in the
execution stream, and they are guaranteed to be visible to later instructions in the execution stream.
See Advanced SIMD and Floating-point Extension system registers on page B1-1235 for the system level view of
the registers.
The VFPv3U variant of the VFPv3 extension, and the VFPv4U variant of the VFPv4 extension, implement
exception trap enable bits in the FPSCR, and provide exception handling as described in Floating-point support
code on page B1-1236. There is a separate trap enable bit for each of the six floating-point exceptions described in
Floating-point exceptions on page A2-69. Except for support for this trapping mechanism:
• The VFPv3U architecture is identical to VFPv3.
• The VFPv4U architecture is identical to VFPv4.
Trapped exception handling never causes the corresponding cumulative exception bit of the FPSCR to be set to 1.
If this behavior is desired, the trap handler routine must use a read, modify, write sequence on the FPSCR to set the
cumulative exception bit.
Both VFPv3U and VFPv4U can be implemented with either 32 or 16 doubleword registers. That is:
• VFPv3U can be implemented as VFPv3U-D32, or as VFPv3U-D16.
• VFPv4U can be implemented as VFPv4U-D32, or as VFPv4U-D16.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-61
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
ARM standard floating-point arithmetic means IEEE 754 floating-point arithmetic with the following restrictions:
• denormalized numbers are flushed to zero, see Flush-to-zero on page A2-67
• only default NaNs are supported, see NaN handling and the Default NaN on page A2-68
• the Round to Nearest rounding mode selected, by setting FPSCR.RMode to 0b00
• untrapped exception handling selected for all floating-point exceptions, by setting FPSCR[15, 12:8] to
0b000000.
In ARMv7 implementations, trapped floating-point exception handling is supported in the VFPv3U and VFPv4U
variants of the Floating-point Extension, see VFPv3U and VFPv4U on page A2-61. In implementations of previous
architecture versions, it is supported in VFPv2.
The Advanced SIMD Extension supports only single-precision ARM standard floating-point arithmetic.
Note
Implementations of the Floating-point Extension require support code to be installed in the system if trapped
floating-point exception handling is required. See Floating-point support code on page B1-1236.
Some implementations might also require support code to support other aspects of their floating-point arithmetic.
However, with the ARMv7 architecture, ARM deprecates using support code in this way.
It is IMPLEMENTATION DEFINED which aspects of Floating-point Extension floating-point arithmetic are supported
in a system without support code installed.
Aspects of floating-point arithmetic that are implemented in support code are likely to run much more slowly than
those that are executed in hardware.
• To maximize the chance of getting high floating-point performance, software developers use ARM standard
floating-point arithmetic.
• Software developers check whether their systems have support code installed, and if not, observe the
IMPLEMENTATION DEFINED restrictions on what operations their Floating-point Extension implementation
can handle without support code.
The following sections give more information about ARM floating-point data types and arithmetic:
• ARM standard floating-point input and output values.
• Advanced SIMD and Floating-point single-precision format on page A2-63.
• Floating-point double-precision format on page A2-64.
• Advanced SIMD and Floating-point half-precision formats on page A2-65.
• Flush-to-zero on page A2-67.
• NaN handling and the Default NaN on page A2-68.
• Floating-point exceptions on page A2-69.
• Pseudocode details of floating-point operations on page A2-72.
A2-62 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
• Normalized numbers.
• Denormalized numbers are flushed to 0 before floating-point operations, see Flush-to-zero on page A2-67.
• NaNs.
• Infinities.
ARM standard floating-point arithmetic supports the Round to Nearest rounding mode defined by the IEEE 754
standard.
ARM standard floating-point arithmetic supports the following output result formats defined by the IEEE 754
standard:
• Zeros.
• Normalized numbers.
• Results that are less than the minimum normalized number are flushed to zero, see Flush-to-zero on
page A2-67.
• NaNs produced in floating-point operations are always the default NaN, see NaN handling and the Default
NaN on page A2-68.
• Infinities.
This description includes ARM-specific details that are left open by the standard. It is only intended as an
introduction to the formats and to the values they can contain. For full details, especially of the handling of infinities,
NaNs and signed zeros, see the IEEE 754 standard.
S exponent fraction
The interpretation of the format depends on the value of the exponent field, bits[30:23]:
exponent == 0
The value is either a zero or a denormalized number, depending on the fraction bits:
fraction == 0
The value is a zero. There are two distinct zeros:
+0 When S==0.
–0 When S==1.
These usually behave identically. In particular, the result is equal if +0 and –0 are
compared as floating-point numbers. However, they yield different results in some
circumstances. For example, the sign of the infinity produced as the result of dividing
by zero depends on the sign of the zero. The two zeros can be distinguished from each
other by performing an integer comparison of the two words.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-63
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
fraction != 0
The value is a denormalized number and is equal to:
(–1)S × 2–126 × (0.fraction)
The minimum positive denormalized number is 2–149, or approximately 1.401 × 10–45.
Denormalized numbers are always flushed to zero in the Advanced SIMD Extension. They are
optionally flushed to zero in the Floating-point Extension. For details see Flush-to-zero on
page A2-67.
exponent == 0xFF
The value is either an infinity or a Not a Number (NaN), depending on the fraction bits:
fraction == 0
The value is an infinity. There are two distinct infinities:
+infinity When S==0. This represents all positive numbers that are too big to be
represented accurately as a normalized number.
-infinity When S==1. This represents all negative numbers with an absolute value
that is too big to be represented accurately as a normalized number.
fraction != 0
The value is a NaN, and is either a quiet NaN or a signaling NaN.
In the Floating-point Extension, the two types of NaN are distinguished on the basis of
their most significant fraction bit, bit[22]:
bit[22] == 0
The NaN is a signaling NaN. The sign bit can take any value, and the
remaining fraction bits can take any value except all zeros.
bit[22] == 1
The NaN is a quiet NaN. The sign bit and remaining fraction bits can take
any value.
For details of the default NaN see NaN handling and the Default NaN on page A2-68.
Note
NaNs with different sign or fraction bits are distinct NaNs, but this does not mean software can use floating-point
comparison instructions to distinguish them. This is because the IEEE 754 standard specifies that a NaN compares
as unordered with everything, including itself.
This description includes Floating-point Extension-specific details that are left open by the standard. It is only
intended as an introduction to the formats and to the values they can contain. For full details, especially of the
handling of infinities, NaNs and signed zeros, see the IEEE 754 standard.
63 62 52 51 32 31 0
S exponent fraction
Double-precision values represent numbers, infinities and NaNs in a similar way to single-precision values, with
the interpretation of the format depending on the value of the exponent:
A2-64 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
exponent == 0
The value is either a zero or a denormalized number, depending on the fraction bits:
fraction == 0
The value is a zero. There are two distinct zeros that behave analogously to the two
single-precision zeros:
+0 when S==0.
–0 when S==1.
fraction != 0
The value is a denormalized number and is equal to:
(-1)S × 2–1022 × (0.fraction).
The minimum positive denormalized number is 2–1074, or approximately 4.941 × 10–324.
Optionally, denormalized numbers are flushed to zero in the Floating-point Extension. For details
see Flush-to-zero on page A2-67.
exponent == 0x7FF
The value is either an infinity or a NaN, depending on the fraction bits:
fraction == 0
the value is an infinity. As for single-precision, there are two infinities:
+infinity When S==0.
-infinity When S==1.
fraction != 0
The value is a NaN, and is either a quiet NaN or a signaling NaN.
In the Floating-point Extension, the two types of NaN are distinguished on the basis of
their most significant fraction bit, bit[51] of the doubleword:
bit[51] == 0
The NaN is a signaling NaN. The sign bit can take any value, and the
remaining fraction bits can take any value except all zeros.
bit[51] == 1
The NaN is a quiet NaN. The sign bit and the remaining fraction bits can
take any value.
For details of the default NaN, see NaN handling and the Default NaN on page A2-68.
Note
NaNs with different sign or fraction bits are distinct NaNs, but this does not mean software can use floating-point
comparison instructions to distinguish them. This is because the IEEE 754 standard specifies that a NaN compares
as unordered with everything, including itself.
The description of IEEE half-precision includes ARM-specific details that are left open by the standard, and is only
an introduction to the formats and to the values they can contain. For more information, especially on the handling
of infinities, NaNs, and signed zeros, see the IEEE 754 standard.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-65
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
For both half-precision floating-point formats, the layout of the 16-bit number is the same. The format is:
15 14 10 9 0
S exponent fraction
The interpretation of the format depends on the value of the exponent field, bits[14:10] and on which half-precision
format is being used.
exponent == 0
The value is either a zero or a denormalized number, depending on the fraction bits:
fraction == 0
The value is a zero. There are two distinct zeros:
+0 when S==0.
–0 when S==1.
fraction != 0
The value is a denormalized number and is equal to:
(–1)S × 2–14 × (0.fraction).
The minimum positive denormalized number is 2–24, or approximately 5.960 × 10–8.
exponent == 0x1F
The value depends on which half-precision format is being used:
IEEE half-precision
The value is either an infinity or a Not a Number (NaN), depending on the fraction bits:
fraction == 0
The value is an infinity. There are two distinct infinities:
+infinity When S==0. This represents all positive numbers that are too
big to be represented accurately as a normalized number.
-infinity When S==1. This represents all negative numbers with an
absolute value that is too big to be represented accurately as a
normalized number.
fraction != 0
The value is a NaN, and is either a quiet NaN or a signaling NaN. The two
types of NaN are distinguished by their most significant fraction bit, bit[9]:
bit[9] == 0 The NaN is a signaling NaN. The sign bit can take any value,
and the remaining fraction bits can take any value except all
zeros.
bit[9] == 1 The NaN is a quiet NaN. The sign bit and remaining fraction
bits can take any value.
Alternative half-precision
The value is a normalized number and is equal to:
-1S × 216 × (1.fraction).
The maximum positive normalized number is (2-2-10) × 216 or 131008.
A2-66 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
A2.7.5 Flush-to-zero
The performance of floating-point implementations can be significantly reduced when performing calculations
involving denormalized numbers and Underflow exceptions. In particular this occurs for implementations that only
handle normalized numbers and zeros in hardware, and invoke support code to handle any other types of value. For
an algorithm where a significant number of the operands and intermediate results are denormalized numbers, this
can result in a considerable loss of performance.
In many of these algorithms, this performance can be recovered, without significantly affecting the accuracy of the
final result, by replacing the denormalized operands and intermediate results with zeros. To permit this optimization,
Floating-point Extension implementations have a special processing mode called Flush-to-zero mode. Advanced
SIMD implementations always use Flush-to-zero mode.
Behavior in Flush-to-zero mode differs from normal IEEE 754 arithmetic in the following ways:
• All inputs to floating-point operations that are double-precision denormalized numbers or single-precision
denormalized numbers are treated as though they were zero. This causes an Input Denormal exception, but
does not cause an Inexact exception. The Input Denormal exception occurs only in Flush-to-zero mode.
Note
Combinations of exceptions on page A2-70 defines the floating-point operations.
The FPSCR contains a cumulative exception bit FPSCR.IDC and trap enable bit FPSCR.IDE corresponding
to the Input Denormal exception.
The occurrence of all exceptions except Input Denormal is determined using the input values after
flush-to-zero processing has occurred.
• The result of a floating-point operation is flushed to zero if the result of the operation before rounding
satisfies the condition:
0 < Abs(result) < MinNorm, where:
— MinNorm is 2-126 for single-precision.
— MinNorm is 2-1022 for double-precision.
This causes the FPSCR.UFC bit to be set to 1, and prevents any Inexact exception from occurring for the
operation.
Underflow exceptions occur only when a result is flushed to zero.
In a VFPv2, VFPv3U, or VFPv4U implementation Underflow exceptions that occur in Flush-to-zero mode
are always treated as untrapped, even when the Underflow trap enable bit, FPSCR.UFE, is set to 1.
• An Inexact exception does not occur if the result is flushed to zero, even though the final result of zero is not
equivalent to the value that would be produced if the operation were performed with unbounded precision
and exponent range.
When an input or a result is flushed to zero the value of the sign bit of the zero is determined as follows:
• In VFPv4, VFPv4U, VFPv3, or VFPv3U, it is preserved. That is, the sign bit of the zero matches the sign bit
of the input or result that is being flushed to zero.
• In VFPv2, it is IMPLEMENTATION DEFINED whether it is preserved or always positive. The same choice must
be made for all cases of flushing an input or result to zero.
Flush-to-zero mode has no effect on half-precision numbers that are inputs to floating-point operations, or results
from floating-point operations.
Note
Flush-to-zero mode is incompatible with the IEEE 754 standard, and must not be used when IEEE 754 compatibility
is a requirement. Flush-to-zero mode must be used with care. Although it can improve performance on some
algorithms, there are significant limitations on its use. These are application dependent:
• On many algorithms, it has no noticeable effect, because the algorithm does not normally use denormalized
numbers.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-67
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
• On other algorithms, it can cause exceptions to occur or seriously reduce the accuracy of the results of the
algorithm.
• An operation that produces an Invalid Operation floating-point exception generates a quiet NaN as its result
if that exception is untrapped.
• An operation involving a quiet NaN operand, but not a signaling NaN operand, returns an input NaN as its
result.
The Floating-point Extension behavior when Default NaN mode is disabled adheres to this, with the following
additions:
• If an untrapped Invalid Operation floating-point exception is produced, the quiet NaN result is derived from:
— The first signaling NaN operand, if the exception was produced because at least one of the operands
is a signaling NaN.
— Otherwise, the default NaN
• If an untrapped Invalid Operation floating-point exception is not produced, but at least one of the operands
is a quiet NaN, the result is derived from the first quiet NaN operand.
Depending on the operation, the exact value of a derived quiet NaN result may differ in both sign and number of
fraction bits from its source. For a quiet NaN result derived from signaling NaN operand, the most-significant
fraction bit is set to 1.
Note
• In these descriptions, first operand relates to the left-to-right ordering of the arguments to the pseudocode
function that describes the operation.
• The IEEE 754 standard specifies that the sign bit of a NaN has no significance.
The Floating-point Extension behavior when Default NaN mode is enabled, and the Advanced SIMD behavior in
all circumstances, is that the Default NaN is the result of all floating-point operations that either:
• Generate untrapped Invalid Operation floating-point exceptions.
• Have one or more quiet NaN inputs, but no signaling NaN inputs.
Table A2-7 shows the format of the default NaN for ARM floating-point processors.
Default NaN mode is selected for the Floating-point Extension by setting the FPSCR.DN bit to 1.
Other aspects of the functionality of the Invalid Operation exception are not affected by Default NaN mode. These
are that:
• If untrapped, it causes the FPSCR.IOC bit be set to 1.
• If trapped, it causes a user trap handler to be invoked. This is only possible in VFPv2, VFPv3U, and VFPv4U.
Sign bit 0 0a 0a
A2-68 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
FPSCR.IOC Invalid Operation. The bit is set to 1 if the result of an operation has no mathematical value or cannot
be represented. Cases include, for example:
• (infinity) × 0.
• (+infinity) + (–infinity).
These tests are made after flush-to-zero processing. For example, if flush-to-zero mode is selected,
multiplying a denormalized number and an infinity is treated as (0 × infinity), and causes an Invalid
Operation floating-point exception.
IOC is also set on any floating-point operation with one or more signaling NaNs as operands, except
for negation and absolute value, as described in Floating-point negation and absolute value on
page A2-74.
FPSCR.DZC Division by Zero. The bit is set to 1 if a divide operation has a zero divisor and a dividend that is
not zero, an infinity or a NaN. These tests are made after flush-to-zero processing, so if flush-to-zero
processing is selected, a denormalized dividend is treated as zero and prevents Division by Zero
from occurring, and a denormalized divisor is treated as zero and causes Division by Zero to occur
if the dividend is a normalized number.
For the reciprocal and reciprocal square root estimate functions the dividend is assumed to be +1.0.
This means that a zero or denormalized operand to these functions sets the DZC bit.
FPSCR.OFC Overflow. The bit is set to 1 if the absolute value of the result of an operation, produced after
rounding, is greater than the maximum positive normalized number for the destination precision.
FPSCR.UFC Underflow. The bit is set to 1 if the absolute value of the result of an operation, produced before
rounding, is less than the minimum positive normalized number for the destination precision, and
the rounded result is inexact.
The criteria for the Underflow exception to occur are different in Flush-to-zero mode. For details,
see Flush-to-zero on page A2-67.
FPSCR.IXC Inexact. The bit is set to 1 if the result of an operation is not equivalent to the value that would be
produced if the operation were performed with unbounded precision and exponent range.
The criteria for the Inexact exception to occur are different in Flush-to-zero mode. For details, see
Flush-to-zero on page A2-67.
FPSCR.IDC Input Denormal. The bit is set to 1 if a denormalized input operand is replaced in the computation
by a zero, as described in Flush-to-zero on page A2-67.
With the Advanced SIMD Extension and the VFPv3 or VFPv4 versions of the Floating-point Extension these are
non-trapping exceptions and the data-processing instructions do not generate any trapped exceptions.
With the VFPv2, VFPv3U, and VFPv4U versions of the Floating-point Extension:
• These exceptions can be trapped, by setting trap enable bits in the FPSCR, see VFPv3U and VFPv4U on
page A2-61. The way in which trapped floating-point exceptions are delivered to user software is
IMPLEMENTATION DEFINED. However, ARM recommends use of the VFP subarchitecture defined in
Appendix D6 Common VFP Subarchitecture Specification.
• The definition of the Underflow exception is different in the trapped and cumulative exception cases. In the
trapped case, meaning for VFPv2, VFPv3U, or VFPv4U, the definition is:
— The trapped Underflow exception occurs if the absolute value of the result of an operation, produced
before rounding, is less than the minimum positive normalized number for the destination precision,
regardless of whether the rounded result is inexact.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-69
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
• As with cumulative exceptions, higher priority trapped exceptions can prevent lower priority exceptions from
occurring, as described in Combinations of exceptions.
Exception type Default result for positive sign Default result for negative sign
In Table A2-8:
MaxNorm The maximum normalized number of the destination precision.
RM Round towards Minus Infinity mode, as defined in the IEEE 754 standard.
RN Round to Nearest mode, as defined in the IEEE 754 standard.
RP Round towards Plus Infinity mode, as defined in the IEEE 754 standard.
RZ Round towards Zero mode, as defined in the IEEE 754 standard.
• For Invalid Operation exceptions, for details of which quiet NaN is produced as the default result see NaN
handling and the Default NaN on page A2-68.
• For Division by Zero exceptions, the sign bit of the default result is determined normally for a division. This
means it is the exclusive OR of the sign bits of the two operands.
• For Overflow exceptions, the sign bit of the default result is determined normally for the overflowing
operation.
Combinations of exceptions
The following pseudocode functions perform floating-point operations:
FixedToFP()
FPAdd()
FPCompare()
FPCompareEQ()
FPCompareGE()
FPCompareGT()
FPDiv()
FPDoubleToSingle()
FPHalfToSingle()
FPMax()
FPMin()
FPMul()
FPMulAdd()
FPRecipEstimate()
FPRecipStep()
FPRSqrtEstimate()
FPRSqrtStep()
FPSingleToDouble()
FPSingleToHalf()
FPSqrt()
FPSub()
A2-70 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
FPToFixed()
Note
FPAbs() and FPNeg() are not classified as floating-point operations because:
• They cannot generate floating-point exceptions.
• The floating-point operation behavior described in the following sections does not apply to them:
— Flush-to-zero on page A2-67.
— NaN handling and the Default NaN on page A2-68.
More than one exception can occur on the same operation. The only combinations of exceptions that can occur are:
• Overflow with Inexact.
• Underflow with Inexact.
• Input Denormal with other exceptions.
When none of the exceptions caused by an operation are trapped, any exception that occurs causes the associated
cumulative bit in the FPSCR to be set.
When one or more exceptions caused by an operation are trapped, the behavior of the instruction depends on the
priority of the exceptions. The Inexact exception is treated as lowest priority, and Input Denormal as highest priority:
• If the higher priority exception is trapped, its trap handler is called. It is IMPLEMENTATION DEFINED whether
the parameters to the trap handler include information about the lower priority exception. Apart from this,
the lower priority exception is ignored in this case.
• If the higher priority exception is untrapped, its cumulative bit is set to 1 and its default result is evaluated.
Then the lower priority exception is handled normally, using this default result.
Some floating-point instructions specify more than one floating-point operation, as indicated by the pseudocode
descriptions of the instruction. In such cases, an exception on one operation is treated as higher priority than an
exception on another operation if the occurrence of the second exception depends on the result of the first operation.
Otherwise, it is UNPREDICTABLE which exception is treated as higher priority.
For example, a VMLA.F32 instruction specifies a floating-point multiplication followed by a floating-point addition.
The addition can generate Overflow, Underflow and Inexact exceptions, all of which depend on both operands to
the addition and so are treated as lower priority than any exception on the multiplication. The same applies to Invalid
Operation exceptions on the addition caused by adding opposite-signed infinities. The addition can also generate an
Input Denormal exception, caused by the addend being a denormalized number while in Flush-to-zero mode. It is
UNPREDICTABLE which of an Input Denormal exception on the addition and an exception on the multiplication is
treated as higher priority, because the occurrence of the Input Denormal exception does not depend on the result of
the multiplication. The same applies to an Invalid Operation exception on the addition caused by the addend being
a signaling NaN.
Note
• The VFMA instruction performs a vector addition and a vector multiplication as a single operation. The VFMS
instruction performs a vector subtraction and a vector multiplication as a single operation.
• Like other details of Floating-point instruction execution, these rules about exception handling apply to the
overall results produced by an instruction when the system uses a combination of hardware and support code
to implement it. See Floating-point support code on page B1-1236 for more information.
These principles also apply to the multiple floating-point operations generated by Floating-point instructions
in the deprecated VFP vector mode of operation. For details of this mode of operation, see Appendix D11
VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-71
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
// FPZero()
// ========
F = N - E - 1;
exp = Zeros(E);
frac = Zeros(F);
return sign:exp:frac;
// FPTwo()
// =======
bits(N) FPTwo(integer N)
assert N IN {32,64};
if N == 16 then
E = 5;
elsif N == 32 then
E = 8;
else E = 11;
F = N - E - 1;
sign = '0';
exp = '1':Zeros(E-1);
frac = Zeros(F);
return sign:exp:frac;
// FPThree()
// =========
bits(N) FPThree(integer N)
A2-72 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
assert N IN {32,64};
if N == 16 then
E = 5;
elsif N == 32 then
E = 8;
else E = 11;
F = N - E - 1;
sign = '0';
exp = '1':Zeros(E-1);
frac = '1':Zeros(F-1);
return sign:exp:frac;
// FPMaxNormal()
// =============
F = N - E - 1;
exp = Ones(E-1):'0';
frac = Ones(F);
return sign:exp:frac;
// FPInfinity()
// ============
F = N - E - 1;
exp = Ones(E);
frac = Zeros(F);
return sign:exp:frac;
// FPDefaultNaN()
// ==============
bits(N) FPDefaultNaN(integer N)
assert N IN {16,32,64};
if N == 16 then
E = 5;
elsif N == 32 then
E = 8;
else E = 11;
F = N - E - 1;
sign = '0';
exp = Ones(E);
frac = '1':Zeros(F-1);
return sign:exp:frac;
Note
This definition of FPDefaultNaN() applies to VFPv4, VFPv4U, VFPv3, and VFPv3U implementations. For VFPv2,
the sign bit of the result is a single-bit UNKNOWN value, instead of 0.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-73
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
// FPNeg()
// =======
// FPAbs()
// =======
// FPUnpack()
// ==========
//
// Unpack a floating-point number into its type, sign bit and the real number
// that it represents. The real number result has the correct sign for numbers
// and infinities, is very large in magnitude for infinities, and is 0.0 for
// NaNs. (These values are chosen to simplify the description of comparisons
// and conversions.)
//
// The 'fpscr_val' argument supplies FPSCR control bits. Status information is
// updated directly in the FPSCR where appropriate.
if N == 16 then
sign = fpval<15>;
exp16 = fpval<14:10>;
frac16 = fpval<9:0>;
if IsZero(exp16) then
// Produce zero if value is zero
if IsZero(frac16) then
type = FPType_Zero; value = 0.0;
else
type = FPType_Nonzero; value = 2.0^-14 * (UInt(frac16) * 2.0^-10);
elsif IsOnes(exp16) && fpscr_val<26> == '0' then // Infinity or NaN in IEEE format
if IsZero(frac16) then
type = FPType_Infinity; value = 2.0^1000000;
else
type = if frac16<9> == '1' then FPType_QNaN else FPType_SNaN;
value = 0.0;
else
type = FPType_Nonzero; value = 2.0^(UInt(exp16)-15) * (1.0 + UInt(frac16) * 2.0^-10);
elsif N == 32 then
sign = fpval<31>;
exp32 = fpval<30:23>;
frac32 = fpval<22:0>;
if IsZero(exp32) then
// Produce zero if value is zero or flush-to-zero is selected.
A2-74 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
else // N == 64
sign = fpval<63>;
exp64 = fpval<62:52>;
frac64 = fpval<51:0>;
if IsZero(exp64) then
// Produce zero if value is zero or flush-to-zero is selected.
if IsZero(frac64) || fpscr_val<24> == '1' then
type = FPType_Zero; value = 0.0;
if !IsZero(frac64) then // Denormalized input flushed to zero
FPProcessException(FPExc_InputDenorm, fpscr_val);
else
type = FPType_Nonzero; value = 2.0^-1022 * (UInt(frac64) * 2.0^-52);
elsif IsOnes(exp64) then
if IsZero(frac64) then
type = FPType_Infinity; value = 2.0^1000000;
else
type = if frac64<51> == '1' then FPType_QNaN else FPType_SNaN;
value = 0.0;
else
type = FPType_Nonzero; value = 2.0^(UInt(exp64)-1023) * (1.0 + UInt(frac64) * 2.0^-52);
// FPProcessException()
// ====================
//
// The 'fpscr_val' argument supplies FPSCR control bits. Status information is
// updated directly in the FPSCR where appropriate.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-75
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
return;
The FPProcessNaN() function processes a NaN operand, producing the correct result value and generating an Invalid
Operation exception if necessary:
// FPProcessNaN()
// ==============
//
// The 'fpscr_val' argument supplies FPSCR control bits. Status information is
// updated directly in the FPSCR where appropriate.
The FPProcessNaNs() function performs the standard NaN processing for a two-operand operation:
// FPProcessNaNs()
// ===============
//
// The boolean part of the return value says whether a NaN has been found and
// processed. The bits(N) part is only relevant if it has and supplies the
// result of the operation.
//
// The 'fpscr_val' argument supplies FPSCR control bits. Status information is
// updated directly in the FPSCR where appropriate.
The FPProcessNaNs3() function performs the standard NaN processing for a three-operand operation:
// FPProcessNaNs3()
// ===============
//
// The boolean part of the return value says whether a NaN has been found and
// processed. The bits(N) part is only relevant if it has and supplies the
// result of the operation.
//
// The 'fpscr_val' argument supplies FPSCR control bits. Status information is
// updated directly in the FPSCR where appropriate.
A2-76 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
Floating-point rounding
The FPRound() function rounds and encodes a supplied floating-point value to a specified destination format. This
includes processing Overflow, Underflow, and Inexact floating-point exceptions and performing flush-to-zero
processing on the resulting value.
// FPRound()
// =========
//
// The 'fpscr_val' argument supplies FPSCR control bits. Status information is
// updated directly in the FPSCR where appropriate.
// Obtain format parameters - minimum exponent, numbers of exponent and fraction bits.
if N == 16 then
E = 5;
elsif N == 32 then
E = 8;
else E = 11;
minimum_exp = 2 - 2^(E-1);
F = N - E - 1;
else
// Start creating the exponent value for the result. Start by biasing the actual exponent
// so that the minimum exponent becomes 1, lower values 0 (indicating possible underflow).
biased_exp = Max(exponent - minimum_exp + 1, 0);
if biased_exp == 0 then mantissa = mantissa / 2^(minimum_exp - exponent);
// Get the unrounded mantissa as an integer, and the "units in last place" rounding error.
int_mant = RoundDown(mantissa * 2^F); // < 2^F if biased_exp == 0, >= 2^F if not
error = mantissa * 2^F - int_mant;
// Underflow occurs if exponent is too small before rounding, and result is inexact or
// the Underflow exception is trapped.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-77
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
return result;
// StandardFPSCRValue()
// ====================
bits(32) StandardFPSCRValue()
return '00000' : FPSCR<26> : '11000000000000000000000000';
A2-78 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
Floating-point comparisons
The FPCompare() function compares two floating-point numbers, producing a {N, Z, C, V} condition flags result as
shown in Table A2-9:
Comparison result N Z C V
Equal 0 1 1 0
Less than 1 0 0 0
Greater than 0 0 1 0
Unordered 0 0 1 1
This result defines the operation of the VCMP instruction in the Floating-point Extension. The VCMP instruction writes
these flag values in the FPSCR. After using a VMRS instruction to transfer them to the APSR, they can control
conditional execution as shown in Table A8-1 on page A8-286.
// FPCompare()
// ===========
(bit, bit, bit, bit) FPCompare(bits(N) op1, bits(N) op2, boolean quiet_nan_exc,
boolean fpscr_controlled)
assert N IN {32,64};
fpscr_val = if fpscr_controlled then FPSCR else StandardFPSCRValue();
(type1,sign1,value1) = FPUnpack(op1, fpscr_val);
(type2,sign2,value2) = FPUnpack(op2, fpscr_val);
if type1==FPType_SNaN || type1==FPType_QNaN || type2==FPType_SNaN || type2==FPType_QNaN then
result = ('0','0','1','1');
if type1==FPType_SNaN || type2==FPType_SNaN || quiet_nan_exc then
FPProcessException(FPExc_InvalidOp, fpscr_val);
else
// All non-NaN cases can be evaluated on the values produced by FPUnpack()
if value1 == value2 then
result = ('0','1','1','0');
elsif value1 < value2 then
result = ('1','0','0','0');
else // value1 > value2
result = ('0','0','1','0');
return result;
The FPCompareEQ(), FPCompareGE() and FPCompareGT() functions describe the operation of Advanced SIMD
instructions that perform floating-point comparisons.
// FPCompareEQ()
// =============
// FPCompareGE()
// =============
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-79
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
// FPCompareGT()
// =============
// FPMin()
// =======
A2-80 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
// FPSub()
// =======
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-81
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
// FPDiv()
// =======
A2-82 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
if typeA == FPType_QNaN && ((inf1 && zero2) || (zero1 && inf2)) then
result = FPDefaultNaN(N);
FPProcessException(FPExc_InvalidOp, fpscr_val);
if !done then
infA = (typeA == FPType_Infinity); zeroA = (typeA == FPType_Zero);
// Determine sign and type product will have if it does not cause an Invalid
// Operation.
signP = if sign1 == sign2 then '0' else '1';
infP = inf1 || inf2;
zeroP = zero1 || zero2;
// Non SNaN-generated Invalid Operation cases are multiplies of zero by infinity and
// additions of opposite-signed infinities.
if (inf1 && zero2) || (zero1 && inf2) || (infA && infP && signA == NOT(signP)) then
result = FPDefaultNaN(N);
FPProcessException(FPExc_InvalidOp, fpscr_val);
// Cases where the result is exactly zero and its sign is not determined by the
// rounding mode are additions of same-signed zeros.
elsif zeroA && zeroP && signA == signP then
result = FPZero(signA, N);
return result;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-83
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
The VRECPE instruction produces the initial estimate of the reciprocal. It uses the following pseudocode functions:
// FPRecipEstimate()
// =================
return result;
// UnsignedRecipEstimate()
// =======================
return result;
A2-84 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
double recip_estimate(double a)
{
int q, s;
double r;
q = (int)(a * 512.0); /* a in units of 1/512 rounded down */
r = 1.0 / (((double)q + 0.5) / 512.0); /* reciprocal r */
s = (int)(256.0 * r + 0.5); /* r in units of 1/256 rounded to nearest */
return (double)s / 256.0;
}
Table A2-10 shows the results where input values are out of range.
Floating-point ±infinity ±0
a. FPSCR.DZC is set to 1
xn+1 = xn(2-dxn)
The VRECPS instruction performs a (2 - op1×op2) calculation and can be used with a multiplication to perform a
step of this iteration. The functionality of this instruction is defined by the following pseudocode function:
// FPRecipStep()
// =============
Table A2-11 shows the results where input values are out of range.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-85
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
The VRSQRTE instruction produces the initial estimate of the reciprocal of the square root. It uses the following
pseudocode functions:
// FPRSqrtEstimate()
// =================
A2-86 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
return result;
// UnsignedRSqrtEstimate()
// =======================
return result;
double recip_sqrt_estimate(double a)
{
int q0, q1, s;
double r;
if (a < 0.5) /* range 0.25 <= a < 0.5 */
{
q0 = (int)(a * 512.0); /* a in units of 1/512 rounded down */
r = 1.0 / sqrt(((double)q0 + 0.5) / 512.0); /* reciprocal root r */
}
else /* range 0.5 <= a < 1.0 */
{
q1 = (int)(a * 256.0); /* a in units of 1/256 rounded down */
r = 1.0 / sqrt(((double)q1 + 0.5) / 256.0); /* reciprocal root r */
}
s = (int)(256.0 * r + 0.5); /* r in units of 1/256 rounded to nearest */
return (double)s / 256.0;
}
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-87
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
Table A2-12 shows the results where input values are out of range.
Floating-point +infinity +0
a. FPSCR.DZC is set to 1.
xn+1 = xn(3-dxn2)/2
The VRSQRTS instruction performs a (3 – op1×op2)/2 calculation and can be used with two multiplications to perform
a step of this iteration. The FPRSqrtStep() pseudocode function defines the functionality of this instruction:
// FPRSqrtStep()
// =============
Table A2-13 shows the results where input values are out of range.
// FPHalvedSub()
// =============
A2-88 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
Floating-point conversions
The following functions perform conversions between half-precision and single-precision floating-point numbers.
// FPHalfToSingle()
// ================
// FPSingleToHalf()
// ================
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-89
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
The following functions perform conversions between single-precision and double-precision floating-point
numbers.
// FPSingleToDouble()
// ==================
// FPDoubleToSingle()
// ==================
The following functions perform conversions between floating-point numbers and integers or fixed-point numbers:
// FPToFixed()
// ===========
A2-90 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.7 Floating-point data types and arithmetic
// For NaNs and infinities, FPUnpack() has produced a value that will round to the
// required result of the conversion. Also, the value produced for infinities will
// cause the conversion to overflow and signal an Invalid Operation floating-point
// exception as required. NaNs must also generate such a floating-point exception.
if type == FPType_SNaN || type == FPType_QNaN then
FPProcessException(FPExc_InvalidOp, fpscr_val);
// Scale value by specified number of fraction bits, then start rounding to an integer
// and determine the rounding error.
value = value * 2^fraction_bits;
int_result = RoundDown(value);
error = value - int_result;
// Bitstring result is the integer result saturated to the destination size, with
// saturation indicating overflow of the conversion (signaled as an Invalid
// Operation floating-point exception).
(result, overflow) = SatQ(int_result, M, unsigned);
if overflow then
FPProcessException(FPExc_InvalidOp, fpscr_val);
elsif error != 0.0 then
FPProcessException(FPExc_Inexact, fpscr_val);
return result;
// FixedToFP()
// ===========
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-91
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.8 Polynomial arithmetic over {0, 1}
The coefficients 0 and 1 are manipulated using the rules of Boolean arithmetic:
• 0 + 0 = 1 + 1 = 0.
• 0 + 1 = 1 + 0 = 1.
• 0 × 0 = 0 × 1 = 1 × 0 = 0.
• 1 × 1 = 1.
That is:
• Adding two polynomials over {0, 1} is the same as a bitwise exclusive OR.
• Multiplying two polynomials over {0, 1} is the same as integer multiplication except that partial products are
exclusive-ORed instead of being added.
Note
The instructions that can perform polynomials arithmetic over {0, 1} are VMUL and VMULL, see VMUL, VMULL
(integer and polynomial) on page A8-959.
// PolynomialMult()
// ================
A2-92 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.9 Coprocessor support
• Coprocessor 15 (CP15) provides system control functionality. This includes architecture and feature
identification, as well as control, status information and configuration support.
For a VMSA implementation, the following sections give a general description of CP15:
— About the system control registers for VMSA on page B3-1440.
— Organization of the CP15 registers in a VMSA implementation on page B3-1465.
— Functional grouping of VMSAv7 system control registers on page B3-1486.
For a PMSA implementation, the following sections give a general description of CP15:
— About the system control registers for PMSA on page B5-1766.
— Organization of the CP15 registers in a PMSA implementation on page B5-1779.
— Functional grouping of PMSAv7 system control registers on page B5-1791.
CP15 also provides performance monitor registers, see Chapter C12 The Performance Monitors Extension.
• Coprocessors 10 and 11 (CP10 and CP11) together support floating-point and vector operations, and the
control and configuration of the Floating-point and Advanced SIMD architecture extensions.
• Coprocessors 8, 9, 12, and 13 are reserved for future use by ARM. Any coprocessor access instruction
attempting to access one of these coprocessors is UNDEFINED.
Note
In an implementation that includes either or both of the Advanced SIMD Extension and the Floating-point (VFP)
Extension, to permit execution of any floating-point or Advanced SIMD instructions, software must enable access
to both CP10 and CP11, see Enabling Advanced SIMD and floating-point support on page B1-1228.
The following sections give information more information about permitted accesses to coprocessors CP14 and
CP15:
• UNPREDICTABLE and UNDEFINED behavior for CP14 and CP15 accesses on page B3-1442, for a VMSA
implementation.
• UNPREDICTABLE and UNDEFINED behavior for CP14 and CP15 accesses on page B5-1768, for a PMSA
implementation.
Most CP14 and CP15 functions cannot be accessed by software executing at PL0. This manual clearly identifies
those functions that can be accessed at PL0.
Software executing at PL1 can enable the unprivileged execution of all load, store, branch and data operation
instructions associated with floating-point, Advanced SIMD and execution environment support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-93
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.10 Thumb Execution Environment
From the publication of issue C.a of this manual, ARM deprecates any use of the ThumbEE instruction set.
ThumbEE is particularly suited to languages that feature managed pointers and array types. The processor executes
ThumbEE instructions when it is in the ThumbEE instruction set state. For information about instruction set states
see Instruction set state register, ISETSTATE on page A2-50.
ThumbEE is both the name of the instruction set and the name of the extension that provides support for that
instruction set. The ThumbEE Extension is:
• Required in implementations of the ARMv7-A profile.
• Optional in implementations of the ARMv7-R profile.
See Thumb Execution Environment on page B1-1239 for system level information about ThumbEE.
For more information about the ThumbEE instructions see Chapter A9 The ThumbEE Instruction Set.
Name, VMSA a Name, PMSA a CRn opc1 CRm opc2 Width Type Description
a. VMSA and PMSA definitions of the register fields are identical. These columns link to the descriptions in Chapter B4 and in Chapter B6.
ThumbEE is an unprivileged, user-level facility, and there are no special provisions for using it securely. For more
information, see ThumbEE and the Security Extensions and Virtualization Extensions on page B1-1239.
A2-94 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.10 Thumb Execution Environment
Use of HandlerBase
ThumbEE handlers are entered by reference to a HandlerBase address, defined by the TEEHBR. In addition to the
handlers for IndexCheck and NullCheck, there are 256 handlers, Handler_00 to Handler_FF, at 32-byte offsets from
HandlerBase. Table A2-15 shows the arrangement of handlers relative to the value of HandlerBase:
… … …
The IndexCheck occurs when a CHKA instruction detects an index out of range. For more information, see CHKA on
page A9-1124.
The NullCheck occurs when any memory access instruction is executed with a value of 0 in the base register. For
more information, see Null checking on page A9-1113.
Note
Checks are similar to conditional branches, with the added property that they clear the IT bits when taken.
The other handlers are called using explicit handler call instructions:
• HB and HBL can call any handler, that is, can call Handler_00-Handler_FF.
• HBLP and HBP can call only Handler_00-Handler_31.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-95
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.11 Jazelle direct bytecode execution support
In the simplest implementations of the Jazelle extension, the processor does not accelerate the execution of any
bytecodes, and the JVM uses software routines to execute all bytecodes. Such an implementation is called a trivial
implementation of the Jazelle extension, and has minimal additional cost compared with not implementing the
Jazelle extension at all. An implementation that provides hardware acceleration of bytecode execution is a
non-trivial Jazelle implementation.
The Virtualization Extensions require that the Jazelle implementation is the trivial Jazelle implementation.
These requirements for the Jazelle extension mean a JVM can be written to both:
• Automatically take advantage of the accelerated bytecode execution provided by a processor that includes a
non-trivial implementation.
A non-trivial implementation of the Jazelle extension implements a subset of the bytecodes in hardware, choosing
bytecodes that:
• Can have simple hardware implementations.
• Account for a large percentage of bytecode execution time.
• Normally, the Jazelle instruction set state is never entered. In some implementations, an incorrect exception
return can cause entry to the Jazelle instruction set state. If this happens, the next instruction executed is
treated as UNDEFINED. For more information, see Unimplemented instruction sets on page B1-1155.
• Configuration support that maintains the interface to the Jazelle extension is permanently disabled.
For more information about trivial implementations see Trivial implementation of the Jazelle extension on
page B1-1244.
A JVM that has been written to take advantage automatically of hardware-accelerated bytecode execution is called
an Enabled JVM (EJVM).
A2.11.1 Subarchitectures
A processor implementation that includes the Jazelle extension expects the ARM core register values and other
resources of the ARM processor to conform to an interface standard defined by the Jazelle implementation when
Jazelle state is entered and exited. For example, a specific ARM core register might be reserved for use as the pointer
to the current bytecode.
For an EJVM, and any associated debug support, to function correctly, it must be written to comply with the
interface standard defined by the acceleration hardware at Jazelle state execution entry and exit points.
An implementation of the Jazelle extension might define other configuration registers in addition to the
architecturally defined ones.
A2-96 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.11 Jazelle direct bytecode execution support
The interface standard and any additional configuration registers used for communication with the Jazelle extension
are known collectively as the subarchitecture of the implementation. They are not described in this manual. Only
EJVM implementations and debug or similar software can depend on the subarchitecture. All other software must
rely only on the architectural definition of the Jazelle extension given in this manual. A particular subarchitecture
is identified by reading the JIDR.
While the processor is in Jazelle state, the PC identifies the next JVM bytecode to be executed. A JVM bytecode is
a bytecode defined in The Java Virtual Machine Specification, or a functionally equivalent transformed version of
a bytecode defined in that specification.
For the Jazelle extension, the functionality of Native methods, as described in The Java Virtual Machine
Specification, must be specified using only instructions from the ARM, Thumb, and ThumbEE instruction sets.
An implementation of the Jazelle extension must not be documented or promoted as performing any task while it is
in Jazelle state other than the acceleration of bytecode programs in accordance with this section and the descriptions
in The Java Virtual Machine Specification.
Correct entry into Jazelle state involves the EJVM executing the BXJ instruction at a time when both:
• The Jazelle extension Control and Configuration registers are initialized correctly, see Application level
configuration and control of the Jazelle extension on page A2-98.
• Application level registers and any additional configuration registers are initialized as required by the
subarchitecture of the implementation.
The Jazelle subarchitecture can use Application level registers, but not System level registers, to transfer
information between the Jazelle extension and the EJVM. There are SUBARCHITECTURE DEFINED restrictions on
what Application level registers must contain when a BXJ instruction is executed, and Application level registers
have SUBARCHITECTURE DEFINED values when Jazelle state execution ends and ARM or Thumb state execution
resumes.
Jazelle subarchitectures and implementations must not use any unallocated bits in Application level registers such
as the CPSR or FPSCR. All such bits are reserved for future expansion of the ARM architecture.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-97
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.11 Jazelle direct bytecode execution support
This means that BXJ instructions can be executed freely when the JMCR.JE bit is 0. In particular, if an EJVM
determines that it is executing on a processor whose Jazelle extension implementation is trivial or uses an
incompatible subarchitecture, it can set JE to 0 and execute correctly. In this case it executes without the benefit of
any Jazelle hardware acceleration that might be present.
Name, VMSA a Name, PMSA a CRn opc1 CRm opc2 Width Type b Description
a. VMSA and PMSA definitions of the register fields are identical. These columns link to the descriptions in Chapter B4 and Chapter B6.
b. Type, for a non-trivial Jazelle implementation. Trivial implementation of the Jazelle extension on page B1-1244 describes the register
requirements for a trivial Jazelle implementation.
An EJVM can read the JIDR to determine the architecture and subarchitecture under which it is running, and:
• The JMCR gives application level control of Jazelle operation.
• The JOSCR gives OS level control of Jazelle operation.
The following rules apply to all Jazelle extension control and configuration registers, including any
SUBARCHITECTURE DEFINED registers:
• Registers are accessed by CP14 MRC and MCR instructions with <opc1> set to 7.
• The values contained in configuration registers are changed only by the execution of MCR instructions. In
particular, they are never changed by Jazelle state execution of bytecodes.
• The access policy for each architecturally-defined register is fully defined in the register description. The
access policy of other configuration registers is SUBARCHITECTURE DEFINED.
When execution is unprivileged, MRC and MCR accesses that are restricted to execution at PL1 or higher are
UNDEFINED.
• In an implementation that includes the Security Extensions, the registers are Common registers, meaning
they are common to the Secure and Non-secure security states. For more information, see Classification of
system control registers on page B3-1447.
• When a configuration register can be written, the effect of writing to it must be idempotent. That is, the
overall effect of writing the same value more than once must not differ from the effect of writing it once.
Changes to these CP14 registers have the same synchronization requirements as changes to the CP15 registers.
These are described in:
• Synchronization of changes to system control registers on page B3-1457 for a VMSA implementation.
• Synchronization of changes to system control registers on page B5-1771 for a PMSA implementation.
For more information, see Jazelle state configuration and control on page B1-1242.
A2-98 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.11 Jazelle direct bytecode execution support
Read and write access Read and write access Read and write access permitted
JOSCR JOSCR
UNDEFINED UNDEFINED
SUBARCHITECTURE DEFINED
Read access UNDEFINED Read and write access Read access SUBARCHITECTURE DEFINED
configuration registers Write access permitted UNDEFINED
Write access permitted
Trivial implementation of the Jazelle extension on page B1-1244 describes the required behavior of Jazelle register
accesses for a trivial Jazelle implementation.
Initialization
During initialization, the EJVM must first check which subarchitecture is present, by checking the Implementer and
Subarchitecture codes in the value read from the JIDR.
If the EJVM is incompatible with the subarchitecture, it must do one of the following:
• Write to the JMCR with JE set to 0.
• If unaccelerated bytecode execution is unacceptable, generate an error.
If the EJVM is compatible with the subarchitecture, it must write its required configuration to the JMCR and any
SUBARCHITECTURE DEFINED configuration registers.
Bytecode execution
The EJVM must contain a handler for each bytecode.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-99
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.11 Jazelle direct bytecode execution support
• Performs a BXJ to that handler address with the registers again set up to the SUBARCHITECTURE DEFINED
interface standard.
• Performs a BXJ to that handler address with the registers again set up to the SUBARCHITECTURE DEFINED
interface standard.
Other considerations
To ensure application execution and correct interaction with an operating system, an EJVM must only perform
operations that are permitted in unprivileged operation. In particular, for register accesses they must only:
• Read the JIDR.
• Write to the JMCR, and other configuration registers.
A2-100 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A2 Application Level Programmers’ Model
A2.12 Exceptions, debug events and checks
Exceptions In the ARM architecture, an exception causes entry into a processor mode that executes software at
PL1 or PL2, and execution of a software handler for the exception.
Note
The terms floating-point exception and Jazelle exception condition do not use this meaning of
exception. These terms are described later in this list.
Exceptions include:
• Reset.
• Interrupts.
• Memory system aborts.
• Undefined instructions.
• Supervisor calls (SVCs), Secure Monitor calls (SMCs), and hypervisor calls (HVCs).
Most details of exception handling are not visible to application level software, and are described in
Exception handling on page B1-1164. Aspects that are visible to application level software are:
• The SVC instruction causes a Supervisor Call exception. This provides a mechanism for
unprivileged software to make a call to the operating system, or other system component that
is accessible only at PL1.
• In an implementation that includes the Security Extensions, the SMC instruction causes a
Secure Monitor Call exception, but only if software execution is at PL1 or higher.
Unprivileged software can only cause a Secure Monitor Call exception by methods defined
by the operating system, or by another component of the software system that executes at PL1
or higher.
• In an implementation that includes the Virtualization Extensions, the HVC instruction causes a
Hypervisor Call exception, but only if software execution is at PL1 or higher. Unprivileged
software can only cause a Hypervisor Call exception by methods defined by the hypervisor,
or by another component of the software system that executes at PL1 or higher.
• The WFI instruction provides a hint that nothing needs to be done until the processor takes an
interrupt or similar exception, see Wait For Interrupt on page B1-1202. This permits the
processor to enter a low-power state until that happens.
• The WFE instruction provides a hint that nothing needs to be done until either an SEV instruction
generates an event, or the processor takes an interrupt or similar exception, see Wait For
Event and Send Event on page B1-1199. This permits the processor to enter a low-power state
until one of these happens.
Floating-point exceptions
These relate to exceptional conditions encountered during floating-point arithmetic, such as division
by zero or overflow. For more information see:
• Floating-point exceptions on page A2-69.
• FPSCR, Floating-point Status and Control Register, VMSA on page B4-1566, or FPSCR,
Floating-point Status and Control Register, PMSA on page B6-1839.
• ANSI/IEEE Std. 754, IEEE Standard for Binary Floating-Point Arithmetic.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A2-101
ID040418 Non-Confidential
A2 Application Level Programmers’ Model
A2.12 Exceptions, debug events and checks
Debug events These are conditions that cause a debug system to take action. Most aspects of debug events are not
visible to application level software, and are described in Chapter C3 Debug Events. Aspects that
are visible to application level software include:
• The BKPT instruction causes a BKPT instruction debug event to occur, see BKPT instruction
debug events on page C3-2026.
• The DBG instruction provides a hint to the debug system.
Checks These are provided in the ThumbEE Extension. A check causes an unconditional branch to a
specific handler entry point. The base address of the ThumbEE check handlers is held in the
TEEHBR.
A2-102 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A3
Application Level Memory Model
This chapter gives an application level view of the memory model. It contains the following sections:
• Address space on page A3-104.
• Alignment support on page A3-106.
• Endian support on page A3-108.
• Synchronization and semaphores on page A3-112.
• Memory types and attributes and the memory order model on page A3-123.
• Access rights on page A3-139.
• Virtual and physical addressing on page A3-142.
• Memory access order on page A3-143.
• Caches and memory hierarchy on page A3-153.
Note
In this chapter, system register names usually link to the description of the register in Chapter B4 System Control
Registers in a VMSA implementation, for example SCTLR. If the register is included in a PMSA implementation,
then it is also described in Chapter B6 System Control Registers in a PMSA implementation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-103
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.1 Address space
In some situations the ARM architecture supports accesses to halfwords and words that are not aligned to the
appropriate access size, see Alignment support on page A3-106.
Normally, address calculations are performed using ordinary integer instructions. This means that the address wraps
around if the calculation overflows or underflows the address space. Another way of describing this is that any
address calculation is reduced modulo 232.
Address space underflow occurs when the memory address decrements below the first byte of the address space at
0x00000000. When this happens, the address wraps round, so that, for example, decrementing 0x00000002 by 4 gives
a result of 0xFFFFFFFE.
When a processor performs normal sequential execution of instructions, after each instruction it finds the address
of the next instruction by calculating:
(address_of_current_instruction) + (size_of_executed_instruction).
Note
The size of the executed instruction depends on the current instruction set, and can depend on the instruction
executed.
Any multi-byte memory access that depends on address space overflow or underflow is UNPREDICTABLE. This
applies to both data and instruction accesses.
1. If the processor executes an instruction for which the instruction address, size, and alignment mean it contains
the bytes 0xFFFFFFFF and 0x00000000, the result is UNPREDICTABLE.
Examples of this UNPREDICTABLE behavior include:
• Relying on sequential execution of the instruction at 0x00000000 after any of:
— Executing a 4-byte instruction at 0xFFFFFFFC.
— Executing a 2-byte instruction at 0xFFFFFFFE.
— Executing a 1-byte instruction at 0xFFFFFFFF.
• Attempting to execute an instruction that spans the top of memory, for example:
— A 4-byte instruction at 0xFFFFFFFE.
A3-104 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.1 Address space
2. If the processor executes a load or store instruction for which the computed address, total access size, and
alignment mean it accesses the bytes 0xFFFFFFFF and 0x00000000, the result is UNPREDICTABLE.
Examples of this UNPREDICTABLE behavior include:
• Attempting to perform an unaligned load or store operation that spans the top of memory, for example:
— A word load or store from or to address 0xFFFFFFFD.
— A halfword load or store from or to address 0xFFFFFFFF.
• Attempting to perform a multiple load or store operation that spans the top of memory, for example:
— A two-word load or store from or to addresses 0xFFFFFFFC and 0x00000000.
— An Advanced SIMD multiple-element load or store that includes bytes 0xFFFFFFFF and
0x00000000.
This UNPREDICTABLE behavior only applies to instructions that are executed, including those that fail their condition
code check. Most ARM implementations fetch instructions ahead of the currently-executing instruction. If this
prefetching overflows the top of the address space, it does not cause UNPREDICTABLE behavior unless the prefetched
instruction with an overflowed address is executed.
Note
In some cases, instructions that operate on multiple words can decrement the memory address by 4 after each word
access. If this calculation underflows the address space, the result is UNPREDICTABLE.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-105
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.2 Alignment support
In the ARMv7 architecture, some load and store instructions support unaligned data accesses, as described in
Unaligned data access.
For more information about the alignment support in previous versions of the ARM architecture, see Alignment on
page D12-2492.
LDRB, LDREXB, LDRBT, LDRSB, LDRSBT, STRB, STREXB, STRBT, SWPB, TBB None - -
LDRH, LDRHT, LDRSH, LDRSHT, STRH, STRHT, TBH Halfword Unaligned access Alignment fault
All forms of LDM and STM, LDRD, RFE, SRS, STRD, SWP Word Alignment fault Alignment fault
PUSH, except for encodings T3 and A2
POP, except for encodings T3 and A2
VLDM, VLDR, VPOP, VPUSH, VSTM, VSTR Word Alignment fault Alignment fault
VLD1, VLD2, VLD3, VLD4, VST1, VST2, VST3, VST4, all with standard alignment a Element size Unaligned access Alignment fault
VLD1, VLD2, VLD3, VLD4, VST1, VST2, VST3, VST4, all with :<align> specified a, b As specified Alignment fault Alignment fault
by :<align>
a. These element and structure load/store instructions are only in the Advanced SIMD Extension to the ARMv7 ARM and Thumb instruction
sets. ARMv7 does not support the pre-ARMv6 alignment model, so software cannot use that model with these instructions.
b. Previous versions of this document used @<align> to specify alignment. Both forms are supported, see Advanced SIMD addressing mode
on page A7-275 for more information.
A3-106 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.2 Alignment support
Note
In an implementation that includes the Virtualization Extensions, an unaligned access to Device or Strongly-ordered
memory always causes an Alignment fault Data Abort exception. For implementations that do not include the
Virtualization Extensions, see Cases where unaligned accesses are UNPREDICTABLE.
• Any load instruction that is not faulted by the alignment restrictions shown in Table A3-1 on page A3-106
and that loads the PC has UNPREDICTABLE behavior if the address it loads from is not word-aligned.
• In an implementation that does not include the Virtualization Extensions, any unaligned access that is not
faulted by the alignment restrictions shown in Table A3-1 on page A3-106 and that accesses memory with
the Strongly-ordered or Device memory attribute has UNPREDICTABLE behavior.
Note
— In an implementation that includes the Virtualization Extensions, such an unaligned access to Device
or Strongly-ordered memory generates an Alignment fault, see Alignment faults on page B3-1399.
— Memory types and attributes and the memory order model on page A3-123 describes the
Strongly-ordered and Device memory attributes.
• Accesses are not guaranteed to be single-copy atomic except at the byte access level, see Atomicity in the
ARM architecture on page A3-125. An access can be synthesized out of a series of aligned operations in a
shared memory system without guaranteeing locked transaction cycles.
• Unaligned accesses typically take a number of additional cycles to complete compared to a naturally aligned
transfer. The real-time implications must be analyzed carefully and key data structures might need to have
their alignment adjusted for optimum performance.
• An operation that performs an unaligned access can abort on any memory access that it makes, and can abort
on more than one access. This means that an unaligned access that occurs across a page boundary can
generate an abort on either side of the boundary, or on both sides of the boundary.
Shared memory schemes must not rely on seeing single-copy atomic updates of unaligned data of loads and stores
for data items larger than byte wide. For more information, see Atomicity in the ARM architecture on page A3-125.
Unaligned access operations must not be used for accessing memory-mapped registers in a Device or
Strongly-ordered memory region.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-107
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.3 Endian support
• The doubleword at address A comprises the bytes at addresses A, A+1, A+2, A+3, A+4, A+5, A+6, and A+7.
• The word:
— At address A comprises the bytes at addresses A, A+1, A+2 and A+3.
— At address A+4 comprises the bytes at addresses A+4, A+5, A+6 and A+7.
• The halfword:
— At address A comprises the bytes at addresses A and A+1.
— At address A+2 comprises the bytes at addresses A+2 and A+3.
— At address A+4 comprises the bytes at addresses A+4 and A+5.
— At address A+6 comprises the bytes at addresses A+6 and A+7.
However, this does not specify completely the mappings between words, halfwords, and bytes.
A memory system uses one of the two following mapping schemes. This choice is called the endianness of the
memory system.
• The byte, halfword, or word at an address is the least significant byte, halfword, or word in the doubleword
at that address.
• The byte or halfword at an address is the least significant byte or halfword in the word at that address.
• The byte at an address is the least significant byte in the halfword at that address.
• The byte, halfword, or word at an address is the most significant byte, halfword, or word in the doubleword
at that address.
• The byte or halfword at an address is the most significant byte or halfword in the word at that address.
• The byte at an address is the most significant byte in the halfword at that address.
For an address A, Figure A3-1 on page A3-109 shows, for big-endian and little-endian memory systems, the
relationship between:
• The doubleword at address A.
• The words at addresses A and A+4.
• The halfwords at addresses A, A+2, A+4, and A+6.
• The bytes at addresses A, A+1, A+2, A+3, A+4, A+5, A+6, and A+7.
A3-108 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.3 Endian support
Doubleword at address A
Halfword at address A Halfword at address A+2 Halfword at address A+4 Halfword at address A+6
Byte, A Byte, A+1 Byte, A+2 Byte, A+3 Byte, A+4 Byte, A+5 Byte, A+6 Byte, A+7
Doubleword at address A
Halfword at address A+6 Halfword at address A+4 Halfword at address A+2 Halfword at address A
Byte, A+7 Byte, A+6 Byte, A+5 Byte, A+4 Byte, A+3 Byte, A+2 Byte, A+1 Byte, A
The big-endian and little-endian mapping schemes determine the order in which the bytes of a doubleword, word
or halfword are interpreted. For example, a load of a word from address 0x1000 always results in an access to the
bytes at memory locations 0x1000, 0x1001, 0x1002, and 0x1003. The endianness mapping scheme determines the
significance of these four bytes.
Note
For information about data memory endianness control, see Endianness mapping register, ENDIANSTATE on
page A2-53.
Before ARMv7, the ARM architecture included legacy support for an alternative big-endian memory model,
described as BE-32 and controlled by SCTLR.B bit, bit[7] of the register, see Endian configuration and control on
page D12-2503. ARMv7 does not support BE-32 operation, and bit SCTLR[7] is RAZ/SBZP.
Where legacy object code for ARM processors contains instructions with a big-endian byte order, the removal of
support for BE-32 operation requires the instructions in the object files to have their bytes reversed for the code to
be executed on an ARMv7 processor. This means that:
• Each Thumb instruction, whether a 32-bit Thumb instruction or a 16-bit Thumb instruction, must have the
byte order of each halfword of instruction reversed.
• Each ARM instruction must have the byte order of each word of instruction reversed.
For most situations, this can be handled in the link stage of a tool-flow, provided the object files include sufficient
information to permit this to happen. In practice, this is the situation for all applications with the ARMv7-A profile.
For applications of the ARMv7-R profile, there are some legacy code situations where the arrangement of the bytes
in the object files cannot be adjusted by the linker. For these object files to be used by an ARMv7-R processor the
byte order of the instructions must be reversed by the processor at runtime. Therefore, the ARMv7-R profile permits
configuration of the instruction endianness.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-109
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.3 Endian support
LDRB, LDREXB, LDRBT, LDRSB, LDRSBT, STRB, STREXB, STRBT, SWPB, TBB Byte
LDRH, LDREXH, LDRHT, LDRSH, LDRSHT, STRH, STREXH, STRHT, TBH Halfword
All forms of LDM, PUSH, POP, RFE, SRS, all forms of STM, SWP Word
Forms of VLDM, VLDR, VPOP, VPUSH, VSTM, VSTR that transfer 32-bit Si registers Word
Forms of VLDM, VLDR, VPOP, VPUSH, VSTM, VSTR that transfer 64-bit Di registers Doubleword
VLD1, VLD2, VLD3, VLD4, VST1, VST2, VST3, VST4 Element size of the Advanced SIMD access
In ARMv7, in the ARM and Thumb instruction sets, the following instructions provide this functionality:
REV Reverse word (four bytes) register, for transforming big-endian and little-endian 32-bit
representations, see REV on page A8-563.
REVSH Reverse halfword and sign-extend, for transforming signed 16-bit representations, see REVSH on
page A8-567.
REV16 Reverse packed halfwords in a register for transforming big-endian and little-endian 16-bit
representations, see REV16 on page A8-565.
A3-110 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.3 Endian support
This loads a 64-bit register with four 16-bit values. The four elements appear in the register in array order, with the
lowest indexed element fetched from the lowest address. The order of bytes in the elements depends on the
endianness configuration, as shown in Figure A3-2. Therefore, the order of the elements in the registers is the same
regardless of the endianness configuration.
0 A[7:0] 0 A[15:8]
1 A[15:8] 1 A[7:0]
2 B[7:0] 2 B[15:8]
3 B[15:8] 3 B[7:0]
4 C[7:0] VLD1.16 {D0}, [R1] VLD1.16 {D0}, [R1] 4 C[15:8]
5 C[15:8] 5 C[7:0]
6 D[7:0] 6 D[15:8]
7 D[15:8] 7 D[7:0]
Memory system with Memory system with
little-endian addressing (LE) big-endian addressing (BE)
For information about the alignment of Advanced SIMD instructions see Unaligned data access on page A3-106.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-111
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
From ARMv6, ARM deprecates any use of SWP or SWPB, and the ARMv7 Virtualization Extensions make these
instructions OPTIONAL and deprecated.
Note
• ARM strongly recommends that all software uses the synchronization primitives described in this section,
rather than SWP or SWPB.
• If an implementation does not support the SWP and SWPB instructions, the ID_ISAR0.Swap_instrs and
ID_ISAR4.SWP_frac fields are zero, see About the Instruction Set Attribute registers on page B7-1940.
ARMv6 introduced a new mechanism to support more comprehensive non-blocking synchronization of shared
memory, using synchronization primitives that scale for multiprocessor system designs. ARMv7 extends support for
this mechanism, and provides the following synchronization primitives in the ARM and Thumb instruction sets:
• Load-Exclusives:
— LDREX, see LDREX on page A8-433.
— LDREXB, see LDREXB on page A8-435.
— LDREXD, see LDREXD on page A8-437.
— LDREXH, see LDREXH on page A8-439.
• Store-Exclusives:
— STREX, see STREX on page A8-691.
— STREXB, see STREXB on page A8-693.
— STREXD, see STREXD on page A8-695.
— STREXH, see STREXH on page A8-697.
• Clear-Exclusive, CLREX, see CLREX on page A8-358.
Note
This section describes the operation of a Load-Exclusive/Store-Exclusive pair of synchronization primitives using,
as examples, the LDREX and STREX instructions. The same description applies to any other pair of synchronization
primitives:
• LDREXB used with STREXB.
• LDREXD used with STREXD.
• LDREXH used with STREXH.
Software must use a Load-Exclusive instruction only with the corresponding Store-Exclusive instruction.
The model for the use of a Load-Exclusive/Store-Exclusive instruction pair, accessing a non-aborting memory
address x is:
• The corresponding Store-Exclusive instruction succeeds in writing back to memory address x only if no other
observer, process, or thread has performed a more recent store to address x. The Store-Exclusive operation
returns a status bit that indicates whether the memory write succeeded.
A Load-Exclusive instruction tags a small block of memory for exclusive access. The size of the tagged block is
IMPLEMENTATION DEFINED, see Tagging and the size of the tagged memory block on page A3-119. A
Store-Exclusive instruction to the same address clears the tag.
A3-112 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
Note
In this section, the term processor includes any observer that can generate a Load-Exclusive or a Store-Exclusive.
A Store-Exclusive performs a conditional store to memory, that depends on the state of the local monitor:
The Store-Exclusive instruction defines the register to which the status value is returned.
When a processor writes using any instruction other than a Store-Exclusive it is IMPLEMENTATION DEFINED whether
the write affects the state of the local monitor.
If the local monitor is in the Exclusive Access state and the processor performs a Store-Exclusive to any address
other than the last one from which it performed a Load-Exclusive, it is IMPLEMENTATION DEFINED whether the store
updates memory, but in all cases the local monitor is reset to the Open Access state. This mechanism:
• Is used on a context switch, see Context switch support on page A3-119.
• Must be treated as a software programming error in all other cases.
Note
It is IMPLEMENTATION DEFINED whether a store to a tagged physical address causes a tag in the local monitor to be
cleared if that store is by an observer other than the one that caused the physical address to be tagged.
Figure A3-3 on page A3-114 shows the state machine for the local monitor. Table A3-3 on page A3-114 shows the
effect of each of the operations shown in the figure.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-113
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
LoadExcl(x) LoadExcl(x)
Open Exclusive
Access Access
For more information about tagging, see Tagging and the size of the tagged memory block on page A3-119.
Note
For the local monitor state machine, as shown in Figure A3-3:
• The IMPLEMENTATION DEFINED options for the local monitor are consistent with the local monitor being
constructed so that it does not hold any physical address, but instead treats any access as matching the address
of the previous LoadExcl.
• A local monitor implementation can be unaware of Load-Exclusive and Store-Exclusive operations from
other processors.
• The architecture does not require a load instruction by another processor, that is not a Load-Exclusive
instruction, to have any effect on the local monitor.
• It is IMPLEMENTATION DEFINED whether the transition from Exclusive Access to Open Access state occurs
when the Store or StoreExcl is from another observer.
Table A3-3 shows the effect of the operations shown in Figure A3-3.
Table A3-3 Effect of Exclusive instructions and write operations on the local monitor
LoadExcl(x) Loads value from memory, changes tag to address x Exclusive Access
A3-114 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
Table A3-3 Effect of Exclusive instructions and write operations on the local monitor (continued)
Exclusive Access b
Store(t) Updates memory
Open Access b
a. In the table:
LoadExcl represents any Load-Exclusive instruction.
StoreExcl represents any Store-Exclusive instruction.
Store represents any store operation other than a Store-Exclusive operation.
t is the tagged address, bits[31:a] of the address of the last Load-Exclusive instruction. For more information, see
Tagging and the size of the tagged memory block on page A3-119.
b. IMPLEMENTATION DEFINED alternative actions.
Note
Normal memory that is Inner Non-cacheable, Outer Non-cacheable is inherently coherent between different
processors, and it is IMPLEMENTATION DEFINED whether such memory, if it does not have the Shareable attribute, is
treated as Non-shareable or as Shareable.
• The local monitor cannot be seen to transition to the Exclusive Access state except as a result of the
architectural execution of one of the operations shown in Table A3-3 on page A3-114.
• Any transition of the local monitor to the Open Access state not caused by the architectural execution of an
operation shown in Table A3-3 on page A3-114 must not indefinitely delay forward progress of execution.
• A local monitor for each processor in the system, that tags any address from which the processor executes a
Load-Exclusive. The local monitor operates as described in Exclusive access instructions and Non-shareable
memory regions on page A3-113, except that for Shareable memory any Store-Exclusive is then subject to
checking by the global monitor if it is described in that section as doing at least one of:
— Updating memory.
— Returning a status value of 0.
The local monitor can ignore accesses from other processors in the system.
• A global monitor that tags a physical address as exclusive access for a particular processor. This tag is used
later to determine whether a Store-Exclusive to that address that has not been failed by the local monitor can
occur. Any successful write to the tagged address by any other observer in the shareability domain of the
memory location is guaranteed to clear the tag. For each processor in the system, the global monitor:
— Can hold at least one tagged address.
— Maintains a state machine for each tagged address it can hold.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-115
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
Note
For each processor, the architecture only requires global monitor support for a single tagged address. Any
situation that might benefit from the use of multiple tagged addresses on a single processor is
UNPREDICTABLE, see Load-Exclusive and Store-Exclusive usage restrictions on page A3-120.
In addition, in an implementation that includes the Large Physical Address Extension, when the implementation is
using the Short-descriptor translation table format, it is IMPLEMENTATION DEFINED whether Load-Exclusive and
Store-Exclusive accesses to Non-shareable regions with the Normal, Inner Non-cacheable, Outer Non-cacheable
attribute use the global monitor in addition to the local monitor.
Note
The global monitor can either reside in a processor block or exist as a secondary monitor at the memory interfaces.
The IMPLEMENTATION DEFINED aspects of the monitors mean that the global monitor and local monitor can be
combined into a single unit, provided that unit performs the global monitor and local monitor functions defined in
this manual.
For Shareable regions of memory, in some implementations and for some memory types, the properties of the global
monitor can be met only by functionality outside the processor. Some system implementations might not implement
this functionality for all regions of memory. In particular, this can apply to:
• Any type of memory in the system implementation that does not support hardware cache coherency.
The behavior of Load Exclusive and Store Exclusive instructions when accessing a memory address not monitored
by the global monitor is UNPREDICTABLE.
Note
An implementation can combine the functionality of the global and local monitors into a single unit.
The global monitor only supports a single outstanding exclusive access to Shareable memory per processor. A
Load-Exclusive by one processor has no effect on the global monitor state for any other processor.
• The store is guaranteed to succeed only if the physical address accessed is tagged as exclusive access for the
requesting processor and both the local monitor and the global monitor state machines for the requesting
processor are in the Exclusive Access state. In this case:
— A status value of 0 is returned to a register to acknowledge the successful store.
— The final state of the global monitor state machine for the requesting processor is IMPLEMENTATION
DEFINED.
— If the address accessed is tagged for exclusive access in the global monitor state machine for any other
processor, then that state machine transitions to Open Access state.
• If no address is tagged as exclusive access for the requesting processor, the store does not succeed:
— A status value of 1 is returned to a register to indicate that the store failed.
A3-116 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
— The global monitor is not affected and remains in Open Access state for the requesting processor.
• If a different physical address is tagged as exclusive access for the requesting processor, it is
IMPLEMENTATION DEFINED whether the store succeeds or not:
— If the store succeeds a status value of 0 is returned to a register, otherwise a value of 1 is returned.
— If the global monitor state machine for the processor was in the Exclusive Access state before the
Store-Exclusive it is IMPLEMENTATION DEFINED whether that state machine transitions to the Open
Access state.
The Store-Exclusive instruction defines the register to which the status value is returned.
In a shared memory system, the global monitor implements a separate state machine for each processor in the
system. The state machine for accesses to Shareable memory by processor (n) can respond to all the Shareable
memory accesses visible to it. This means it responds to:
• Accesses generated by the associated processor (n).
• Accesses generated by the other observers in the shareability domain of the memory location (!n).
In a shared memory system, the global monitor implements a separate state machine for each observer that can
generate a Load-Exclusive or a Store-Exclusive in the system.
Figure A3-4 shows the state machine for processor(n) in a global monitor. Table A3-4 on page A3-118 shows the
effect of each of the operations shown in the figure.
LoadExcl(x,n) LoadExcl(x,n)
Open Exclusive
Access Access
Figure A3-4 Global monitor state machine diagram for processor(n) in a multiprocessor system
For more information about tagging, see Tagging and the size of the tagged memory block on page A3-119.
Note
For the global monitor state machine, as shown in Figure A3-4:
• The architecture does not require a load instruction by another processor, that is not a Load-Exclusive
instruction, to have any effect on the global monitor.
• Whether a Store-Exclusive successfully updates memory or not depends on whether the address accessed
matches the tagged Shareable memory address for the processor issuing the Store-Exclusive instruction. For
this reason, Figure A3-4 and Table A3-4 on page A3-118 only show how the (!n) entries cause state
transitions of the state machine for processor(n).
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-117
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
• A Load-Exclusive can only update the tagged Shareable memory address for the processor issuing the
Load-Exclusive instruction.
• The effect of the CLREX instruction on the global monitor is IMPLEMENTATION DEFINED.
• It is IMPLEMENTATION DEFINED:
— Whether a modification to a non-shareable memory location can cause a global monitor to transition
from Exclusive Access to Open Access state.
— Whether a Load-Exclusive to a non-shareable memory location can cause a global monitor to
transition from Open Access to Exclusive Access state.
Table A3-4 shows the effect of the operations shown in Figure A3-4 on page A3-117.
Exclusive LoadExcl(x, n) Loads value from memory, tags address x Exclusive Access
Access
Exclusive Access d
CLREX(n) None. Effect on the final state is IMPLEMENTATION DEFINED.
Open Access d
Open Access
StoreExcl(t, n) Updates memory, returns status 0 c
Exclusive Access
Open Access
Updates memory, returns status 0 d
Exclusive Access
StoreExcl(!t, n)
Open Access
Does not update memory, returns status 1 d
Exclusive Access
StoreExcl(!t, !n) Depends on state machine and tag address for processor issuing STREX Exclusive Access
Exclusive Access d
Store(t, n) Updates memory
Open Access d
A3-118 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
Table A3-4 Effect of load/store operations on global monitor for processor(n) (continued)
LoadExcl(x, !n) Loads value from memory, no effect on tag address for processor(n) Open Access
StoreExcl(x, !n) Depends on state machine and tag address for processor issuing STREX b Open Access
a. In the table:
LoadExcl represents any Load-Exclusive instruction.
StoreExcl represents any Store-Exclusive instruction.
Store represents any store operation other than a Store-Exclusive operation.
t is the tagged address for processor(n), bits[31:a] of the address of the last Load-Exclusive instruction issued by processor(n), see Tagging
and the size of the tagged memory block.
b. The result of a STREX(x, !n) or a STREX(t, !n) operation depends on the state machine and tagged address for the processor issuing the STREX
instruction. This table shows how each possible outcome affects the state machine for processor(n).
c. After a successful STREX to the tagged address, the state of the state machine is IMPLEMENTATION DEFINED. However, this state has no effect
on the subsequent operation of the global monitor.
d. Effect is IMPLEMENTATION DEFINED. The table shows all permitted implementations.
Tagged_address = Memory_address[31:a]
The value of a in this assignment is IMPLEMENTATION DEFINED, between a minimum value of 3 and a maximum
value of 11. For example, in an implementation where a is 4, a successful LDREX of address 0x000341B4 gives a tag
value of bits[31:4] of the address, giving 0x000341B. This means that the four words of memory from 0x000341B0 to
0x000341BF are tagged for exclusive access.
The size of the tagged memory block is called the Exclusives Reservation Granule. The Exclusives Reservation
Granule is IMPLEMENTATION DEFINED in the range 2-512 words:
• 2 words in an implementation where a is 3.
• 512 words in an implementation where a is 11.
In some implementations the CTR identifies the Exclusives Reservation Granule, see either:
• CTR, Cache Type Register, VMSA on page B4-1552.
• CTR, Cache Type Register, PMSA on page B6-1827.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-119
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
Note
• Using a dummy STREX for this purpose is backwards-compatible with the ARMv6 implementation of the
exclusive operations. The CLREX instruction is introduced in ARMv6K.
• Context switching is not an application level operation. However, this information is included here to
complete the description of the exclusive operations.
The STREX or CLREX instruction that follows a context switch might cause a subsequent Store-Exclusive to fail,
requiring a Load-Exclusive … Store-Exclusive sequence to be repeated. To minimize the possibility of this
happening, ARM recommends that the Store-Exclusive instruction is kept as close as possible to the associated
Load-Exclusive instruction, see Load-Exclusive and Store-Exclusive usage restrictions.
These notes describe use of an LDREX/STREX pair, but apply equally to any other Load-Exclusive/Store-Exclusive pair:
• The exclusives support a single outstanding exclusive access for each processor thread that is executed. The
architecture makes use of this by not requiring an address or size check as part of the IsExclusiveLocal()
function. If the target virtual address of an STREX is different from the virtual address of the preceding LDREX
in the same thread of execution, behavior can be UNPREDICTABLE. As a result, an LDREX/STREX pair can only
be relied upon to eventually succeed if they are executed with the same virtual address. Where a context
switch or exception might change the thread of execution, a CLREX instruction or a dummy STREX instruction
must be executed to avoid unwanted effects, as described in Context switch support on page A3-119. Using
an STREX in this way is the only occasion where software can program an STREX with a different address from
the previously executed LDREX.
• If two STREX instructions are executed without an intervening LDREX the second STREX returns a status value
of 1. This means that:
— ARM recommends that, in a given thread of execution, every STREX has a preceding LDREX associated
with it.
— It is not necessary for every LDREX to have a subsequent STREX.
• An implementation of the Load-Exclusive and Store-Exclusive instructions can require that, in any thread of
execution, the transaction size of a Store-Exclusive is the same as the transaction size of the preceding
Load-Exclusive executed in that thread. If the transaction size of a Store-Exclusive is different from the
preceding Load-Exclusive in the same thread of execution, behavior can be UNPREDICTABLE. As a result,
software can rely on an LDREX/STREX pair to eventually succeed only if they have the same size. Where a
context switch or exception might change the thread of execution, the software must execute a CLREX
instruction, or a dummy STREX instruction, to avoid unwanted effects, as described in Context switch support
on page A3-119. Using an STREX in this way is the only occasion where software can use a Store-Exclusive
instruction with a different transaction size from the previously executed Load-Exclusive instruction.
• An implementation might clear an exclusive monitor between the LDREX and the STREX, without any
application-related cause. For example, this might happen because of cache evictions. Software written for
such an implementation must, in any single thread of execution, avoid having any explicit memory accesses,
System control register updates, or cache maintenance operations between the LDREX instruction and the
associated STREX instruction.
• In some implementations, an access to Strongly-ordered or Device memory might clear the exclusive
monitor. Therefore, software must not place a load or a store to Strongly-ordered or Device memory between
an LDREX and an STREX in a single thread of execution.
• Implementations can benefit from keeping the LDREX and STREX operations close together in a single thread of
execution. This minimizes the likelihood of the exclusive monitor state being cleared between the LDREX
instruction and the STREX instruction. Therefore, for best performance, ARM strongly recommends a limit of
128 bytes between LDREX and STREX instructions in a single thread of execution.
A3-120 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
• The architecture sets an upper limit of 2048 bytes on the size of a region that can be marked as exclusive.
Software can read the implemented size of the Exclusives reservation granule from the CTR.ERG field, see:
— CTR, Cache Type Register, VMSA on page B4-1552 for a VMSA implementation.
— CTR, Cache Type Register, PMSA on page B6-1827 for a PMSA implementation.
In a heavily contended system, having multiple objects that are in the same exclusive reservation granule
accessed by exclusive accesses can lead to starvation of a process accessing that granule. Therefore, in such
systems, ARM recommends that objects that are accessed by exclusive accesses are separated by the size of
the Exclusive Reservation Granule.
• It is IMPLEMENTATION DEFINED whether LDREX and STREX operations can be performed to a memory region
with the Device or Strongly-ordered memory attribute. Unless the implementation documentation explicitly
states that LDREX and STREX operations to a memory region with the Device or Strongly-ordered attribute are
permitted, the effect of such operations is UNPREDICTABLE.
• After taking a Data Abort exception, the state of the exclusive monitors is UNKNOWN. Therefore ARM
strongly recommends that the abort handling software performs a CLREX instruction, or a dummy STREX
instruction, to clear the monitor state.
• For the memory location being accessed by a LoadExcl/StoreExcl pair, if the memory attributes for the
LoadExcl instruction differ from the memory attributes for the StoreExcl instruction, behavior is
UNPREDICTABLE.
• The effect of a data or unified cache invalidate, cache clean, or cache clean and invalidate instruction on a
local or global exclusive monitor that is in the Exclusive Access state is UNPREDICTABLE. Execution of the
instruction might clear the monitor, or it might leave it in the Exclusive Access state. For address-based
maintenance instructions, this also applies to the monitors of other processors in the same shareability domain
as the processor executing the cache maintenance instruction, as determined by the shareability domain of
the address being maintained.
Note
ARM strongly recommends that implementations ensure that the use of such maintenance operations by a
processor in the Non-secure state cannot cause a denial of service on a processor in the Secure state.
• If the mapping of the virtual to physical address is changed between the LDREX instruction and the STREX
instruction, and the change is performed using a break-before-make sequence as described in General TLB
maintenance requirements on page B3-1377, if the STREX is performed after another write to the same
physical address as the STREX, and that other write was performed after the old translation was properly
invalidated and that invalidation was properly synchronized, then the STREX will not pass its monitor check.
Note
ARM expects that, in many implementations, either:
— The TLB invalidation will clear either the local or global monitor.
— The physical address will be checked between the LDREX and STREX.
Note
In the event of repeatedly-contending load-exclusive/store-exclusive sequences from multiple processors, an
implementation must ensure that forward progress is made by at least one processor.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-121
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.4 Synchronization and semaphores
A3.4.6 Semaphores
The Swap (SWP) and Swap Byte (SWPB) instructions must be used with care to ensure that expected behavior is
observed. Two examples are as follows:
1. A system with multiple bus masters that uses Swap instructions to implement semaphores that control
interactions between different bus masters.
In this case, the semaphores must be placed in an uncached region of memory, where any buffering of writes
occurs at a point common to all bus masters using the mechanism. The Swap instruction then causes a locked
read-write bus transaction.
2. A system with multiple threads running on a uniprocessor that uses Swap instructions to implement
semaphores that control interaction of the threads.
In this case, the semaphores can be placed in a cached region of memory, and a locked read-write bus
transaction might or might not occur. The Swap and Swap Byte instructions are likely to have better
performance on such a system than they do on a system with multiple bus masters, such as that described in
example 1.
Note
From ARMv6, ARM deprecates use of the Swap and Swap Byte instructions, and strongly recommends that all new
software uses the Load-Exclusive and Store-Exclusive synchronization primitives described in Synchronization and
semaphores on page A3-112, for example LDREX and STREX.
• Portable software for claiming a spin-lock must include a Data Memory Barrier (DMB) operation, performed
by a DMB instruction, between claiming the spin-lock and making any access that makes use of the spin-lock.
• Portable software for releasing a spin-lock must include a DMB instruction before writing to clear the spin-lock.
A3-122 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
A3.5 Memory types and attributes and the memory order model
ARMv6 defined a set of memory attributes with the characteristics required to support the memory and devices in
the system memory map. In ARMv7, this set of attributes is extended by the addition of the Outer Shareable attribute
for Normal memory and, in an implementation that does not include the Large Physical Address Extension, for
Device memory.
Note
Whether an ARMv7 implementation distinguishes between Inner Shareable and Outer Shareable memory is
IMPLEMENTATION DEFINED.
The ordering of accesses for regions of memory, referred to as the memory order model, is defined by the memory
attributes. This model is described in the following sections:
• Memory types.
• Summary of ARMv7 memory attributes on page A3-124.
• Atomicity in the ARM architecture on page A3-125.
• Concurrent modification and execution of instructions on page A3-127.
• Normal memory on page A3-129.
• Device and Strongly-ordered memory on page A3-133.
• Memory access restrictions on page A3-135.
• The effect of the Security Extensions on page A3-138.
Usually, memory used for programs and for data storage is suitable for access using the Normal memory attribute.
Examples of memory technologies for which the Normal memory attribute is appropriate are:
• Programmed Flash ROM.
Note
During programming, Flash memory can be ordered more strictly than Normal memory.
• ROM.
• SRAM.
• DRAM and DDR memory.
System peripherals (I/O) generally conform to different access rules. Examples of I/O accesses are:
• Interrupt controller registers where an access can be used as an interrupt acknowledge, changing the state of
the controller itself.
• Memory controller configuration registers that are used for setting up the timing and correctness of areas of
Normal memory.
• Memory-mapped peripherals, where accessing a memory location can cause side-effects in the system.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-123
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
In ARMv7, the Strongly-ordered or Device memory attribute provides suitable access control for such peripherals.
To ensure correct system behavior, the access rules for Device and Strongly-ordered memory are more restrictive
than those for Normal memory, so that:
Note
However, translation table walks can be made speculatively to memory marked as Device or
Strongly-ordered, see Device and Strongly-ordered memory on page A3-133.
• Read and write accesses cannot be repeated, for example, on return from an exception.
For more information, see Device and Strongly-ordered memory on page A3-133.
• Normal memory on page A3-129 and Shareable attribute for Device memory regions on page A3-134, for
the shareability attribute.
• Write-Through Cacheable, Write-Back Cacheable and Non-cacheable Normal memory on page A3-131, for
cacheability and cache allocation hint attributes.
Note
The cacheability and cache allocation hint attributes apply only to Normal memory. Device and Strongly-ordered
memory regions are Non-cacheable.
In this table:
Shareability Applies only to Normal memory, and to Device memory in an implementation that does not include
the Large Physical Address Extension. In an implementation that includes the Large Physical
Address Extension, Device memory is always Outer Shareable,
When it is possible to assign a shareability attribute to Device memory, ARM deprecates assigning
any attribute other than Shareable or Outer Shareable, see Shareable attribute for Device memory
regions on page A3-134
Whether an ARMv7 implementation distinguishes between Inner Shareable and Outer Shareable
memory is IMPLEMENTATION DEFINED.
Cacheability Applies only to Normal memory, and can be defined independently for Inner and Outer cache
regions. Some cacheability attributes can be complemented by a cache allocation hint. This is an
indication to the memory system of whether allocating a value to a cache is likely to improve
performance. For more information, see Cacheability and cache allocation hint attributes on
page B2-1262.
An implementation might not make any distinction between memory regions with attributes that
differ only in their cache allocation hint.
Strongly- ordered - - -
A3-124 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
No Outer Shareable
Inner Shareable
Non-shareable
Memory model and memory ordering on page D15-2579 compares these attributes with the memory attributes in
architecture versions before ARMv6.
Single-copy atomicity
A read or write operation that is single-copy atomic has the following properties:
• For a single-copy atomic store, if the store overlaps another single-copy atomic store, then all of the writes
from one of the stores are inserted into the Coherence order of each overlapping byte before any of the writes
of the other store are inserted into the Coherence order of the overlapping bytes.
• If a single-copy atomic load overlaps a single-copy atomic store and for any of the overlapping bytes the load
returns the data written by the write inserted into the Coherence order of that byte by the single-copy atomic
store then the load must return data from a point in the Coherence order no earlier than the writes inserted
into the Coherence order by the single-copy atomic store of all of the overlapping bytes.
LDM, LDC, LDC2, LDRD, STM, STC, STC2, STRD, PUSH, POP, RFE, SRS, VLDM, VLDR, VSTM, and VSTR instructions are executed as a
sequence of word-aligned word accesses. Each 32-bit word access is guaranteed to be single-copy atomic. The
architecture does not require subsequences of two or more word accesses from the sequence to be single-copy
atomic.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-125
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
In an implementation that includes the Large Physical Address Extension, LDRD, and STRD accesses to 64-bit aligned
locations are 64-bit single-copy atomic as seen by translation table walks and accesses to translation tables.
Note
The Large Physical Address Extension adds this requirement to avoid the need for complex measures to avoid
atomicity issues when changing translation table entries, without creating a requirement that all locations in the
memory system are 64-bit single-copy atomic. This addition means:
• The system designer must ensure that all writable memory locations that might be used to hold translations,
such as bulk SDRAM, can be accessed with 64-bit single-copy atomicity.
• Software must ensure that translation tables are not held in memory locations that cannot meet this atomicity
requirement, such as peripherals that are typically accessed using a narrow bus.
This requirement places no burden on read-only memory locations for which reads have no side effects, since it is
impossible to detect the size of memory accesses to such locations.
Advanced SIMD element and structure loads and stores are executed as a sequence of accesses of the element or
structure size. The architecture requires the element accesses to be single-copy atomic if and only if both:
• The element size is 32 bits, or smaller.
• The elements are naturally aligned.
Accesses to 64-bit elements or structures that are at least word-aligned are executed as a sequence of 32-bit accesses,
each of which is single-copy atomic. The architecture does not require subsequences of two or more 32-bit accesses
from the sequence to be single-copy atomic.
When an access is not single-copy atomic by the rules described in this section, it is executed as a sequence of one
or more accesses that aggregate to size of the access. Each of the accesses in this sequence is single-copy atomic, at
least at the byte level.
Note
In this section, the terms before the write operation and after the write operation mean before or after the write
operation has had its effect on the coherence order of the bytes of the memory location accessed by the write
operation.
If, according to these rules, an instruction is executed as a sequence of accesses, some exceptions can be taken
during that sequence. Such an exception causes execution of the instruction to be abandoned. These exceptions are:
• The following, if low interrupt latency configuration is selected and the accesses are to Normal memory:
— IRQ interrupts.
— FIQ interrupts.
— Asynchronous aborts.
For more information about this configuration, see Low interrupt latency configuration on page B1-1197.
• For a load:
— Any register being loaded other than one used in the generation of the address by the instruction, might
contain an UNKNOWN value.
— Registers used in the generation of the address are restored to their initial value.
• For a store, any data location being stored to can contain an UNKNOWN value.
If such an instruction is abandoned as a result of a Synchronous Data Abort exception, then see Data Abort
exception on page B1-1214.
A3-126 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
If any of these exceptions are returned from using their preferred return address, the instruction that generated the
sequence of accesses is re-executed and so any access that had been performed before the exception was taken is
repeated.
Note
The exception behavior for these multiple access instructions means they are not suitable for use for writes to
memory for the purpose of software synchronization.
• Cache linefills and evictions have no effect on the single-copy atomicity of explicit transactions or instruction
fetches.
• Translation table walks are performed using accesses that are single-copy atomic:
— At 32-bit granularity when using Short-descriptor format translation tables.
— At 64-bit granularity when using Long-descriptor format translation tables.
Multi-copy atomicity
In a multiprocessing system, writes to a memory location are multi-copy atomic if the following conditions are both
true:
• All writes to the same location are serialized, meaning they are observed in the same order by all observers,
although some observers might not observe all of the writes.
• A read of a location does not return the value of a write until all observers observe that write.
All writes to Device and Strongly-ordered memory that are single-copy atomic are also multi-copy atomic.
Note
All coherent write accesses to the same location are serialized, regardless of whether or not they are multi-copy
atomic. For Normal memory, write accesses can be repeated up to the point that another write to the same address
is observed, and serialization does not prohibit the merging of writes.
Except for the instructions identified in this section, the effect of the concurrent modification and execution of an
instruction is UNPREDICTABLE.
For the following instructions only, the architecture guarantees that, after modification of the instruction, behavior
is consistent with execution of either:
• The instruction originally fetched.
• A fetch of the new instruction. That is, a fetch of the instruction that results from the modification.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-127
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
Note
In the Thumb instruction set:
• The only encodings of BKPT and SVC are 16-bit.
• The only encoding of BL is 32-bit.
1. To ensure that the modified instructions are observable, the thread of execution that is modifying the
instructions must issue the following sequence of instructions and operations:
DCCMVAU [instruction location] ; Clean data cache by MVA to point of unification
DSB ; Ensure visibility of the data cleaned from the cache
ICIMVAU [instruction location] ; Invalidate instruction cache by MVA to PoU
BPIMVAU [instruction location] ; Invalidate branch predictor by MVA to PoU
DSB ; Ensure completion of the invalidations
2. Once the modified instructions are observable, the thread of execution that is executing the modified
instructions must issue the following instructions or operations to ensure execution of the modified
instructions:
ISB ; Synchronize fetched instruction stream
Note
Issue C.a of this manual first describes this behavior, but the description applies to all ARMv7 implementations.
A3-128 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
In addition, for both instruction sets, if one thread of execution changes a conditional branch instruction to another
conditional branch instruction, and the change affects both the condition field and the branch target, execution of
the changed instruction by another thread of execution before the change is synchronized can lead to either:
• The old condition being associated with the new target address.
• The new condition being associated with the old target address.
These possibilities apply regardless of whether the condition, either before or after the change to the branch
instruction, is the always condition.
Normal memory can be read/write or read-only, and a Normal memory region is defined as being either Shareable
or Non-shareable. For Shareable Normal memory, whether a VMSA implementation distinguishes between Inner
Shareable and Outer Shareable is IMPLEMENTATION DEFINED. A PMSA implementation makes no distinction
between Inner Shareable and Outer Shareable regions.
The Normal memory type attribute applies to most memory used in a system.
Accesses to Normal memory have a weakly consistent model of memory ordering. See a standard text describing
memory ordering issues for a description of weakly consistent memory models, for example chapter 2 of Memory
Consistency Models for Shared Memory-Multiprocessors. In general, for Normal memory, barrier operations are
required where the order of memory accesses observed by other observers must be controlled. This requirement
applies regardless of the cacheability and shareability attributes of the Normal memory region.
The ordering requirements of accesses described in Ordering requirements for memory accesses on page A3-146
apply to all explicit accesses.
An instruction that generates a sequence of accesses as described in Atomicity in the ARM architecture on
page A3-125 might be abandoned as a result of an exception being taken during the sequence of accesses. On return
from the exception, the instruction is restarted, and therefore one or more of the memory locations might be accessed
multiple times. This can result in repeated write accesses to a location that has been changed between the write
accesses.
The architecture permits speculative accesses to memory locations marked as Normal if the access permissions and
domain permit an access to the locations.
A Normal memory region has shareability attributes that define the data coherency properties of the region. These
attributes do not affect the coherency requirements of:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-129
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
A region of Normal memory with the Non-shareable attribute does not have any requirement to make data accesses
by different observers coherent, unless the memory is Non-cacheable. If other observers share the memory system,
software must use cache maintenance operations if the presence of caches might lead to coherency issues when
communicating between the observers. This cache maintenance requirement is in addition to the barrier operations
that are required to ensure memory ordering.
For Non-shareable Normal memory, it is IMPLEMENTATION DEFINED whether the Load-Exclusive and
Store-Exclusive synchronization primitives take account of the possibility of accesses by more than one observer.
• In a VMSA implementation, Normal memory that has the Shareable attribute but not the Outer Shareable
attribute assigned is described as having the Inner Shareable attribute.
• In a PMSA implementation, no distinction is made between Inner Shareable and Outer Shareable Normal
memory.
A region of Normal memory with the Shareable attribute is one for which data accesses to memory by different
observers within the same shareability domain are coherent.
The Outer Shareable attribute is introduced in ARMv7, and can be applied only to a Normal memory region in a
VMSA implementation that has the Shareable attribute assigned. It creates three levels of shareability for a Normal
memory region:
Non-shareable A Normal memory region that does not have the Shareable attribute assigned.
Inner Shareable A Normal memory region that has the Shareable attribute assigned, but not the Outer
Shareable attribute.
Outer Shareable A Normal memory region that has both the Shareable and the Outer Shareable attributes
assigned.
These attributes can define sets of observers for which the shareability attributes make the data or unified caches
transparent for data accesses. The sets of observers that are affected by the shareability attributes are described as
shareability domains. The details of the use of these attributes are system-specific. Example A3-1 shows how they
might be used:
In a VMSA implementation, a particular subsystem with two clusters of processors has the requirement that:
• In each cluster, the data or unified caches of the processors in the cluster are transparent for all data accesses
with the Inner Shareable attribute.
In this system, each cluster is in a different shareability domain for the Inner Shareable attribute, but all components
of the subsystem are in the same shareability domain for the Outer Shareable attribute.
A system might implement two such subsystems. If the data or unified caches of one subsystem are not transparent
to the accesses from the other subsystem, this system has two Outer Shareable shareability domains.
However, for a Normal memory region that is Non-cacheable, as described in Write-Through Cacheable,
Write-Back Cacheable and Non-cacheable Normal memory on page A3-131, the only significance of the
Shareability attribute is the behavior of Load-Exclusive and Store-Exclusive instructions. For more information
about this behavior see Synchronization and semaphores on page A3-112.
A3-130 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
Having two levels of shareability attribute means system designers can reduce the performance and power overhead
for shared memory regions that do not need to be part of the Outer Shareable shareability domain.
In a VMSA implementation, for Shareable Normal memory, whether there is a distinction between Inner Shareable
and Outer Shareable is IMPLEMENTATION DEFINED.
For Shareable Normal memory, the Load-Exclusive and Store-Exclusive synchronization primitives take account
of the possibility of accesses by more than one observer in the same Shareability domain.
Note
• System designers can use the Shareable concept to specify the locations in Normal memory that must have
coherency requirements. However, to facilitate porting of software, software developers must not assume that
specifying a memory region as Non-shareable permits software to make assumptions about the incoherency
of memory locations between different processors in a shared memory system. Such assumptions are not
portable between different multiprocessing implementations that make use of the Shareable concept. Any
multiprocessing implementation might implement caches that, inherently, are shared between different
processing elements.
• This architecture is written with an expectation that all processors using the same operating system or
hypervisor are in the same Inner Shareable shareability domain.
• In an ARMv7-A implementation that includes the Large Physical Address Extension, it is IMPLEMENTATION
DEFINED whether the Write-Through Cacheable and Write-Back Cacheable attributes can have an additional
attribute of Transient or Non-transient, see Transient cacheability attribute, Large Physical Address
Extension on page A3-132.
A memory location can be marked as having different cacheability attributes, for example when using aliases in a
virtual to physical address mapping:
• If the attributes differ only in the cache allocation hint this does not affect the behavior of accesses to that
location.
The cacheability attributes provide a mechanism of coherency control with observers that lie outside the shareability
domain of a region of memory. In some cases, the use of Write-Through Cacheable or Non-cacheable regions of
memory might provide a better mechanism for controlling coherency than the use of hardware coherency
mechanisms or the use of cache maintenance routines. To this end, the architecture requires the following properties
for Non-cacheable or Write-Through Cacheable memory:
• A completed write to a memory location that is Non-cacheable or Write-Through Cacheable for a level of
cache made by an observer accessing the memory system inside the level of cache is visible to all observers
accessing the memory system outside the level of cache without the need of explicit cache maintenance.
• A completed write to a memory location that is Non-cacheable for a level of cache made by an observer
accessing the memory system outside the level of cache is visible to all observers accessing the memory
system inside the level of cache without the need of explicit cache maintenance.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-131
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
Note
Implementations can use the cache allocation hints to indicate a probable performance benefit of caching. For
example, a programmer might know that a piece of memory is not going to be accessed again and would be better
treated as Non-cacheable. The distinction between memory regions with attributes that differ only in the cache
allocation hints exists only as a hint for performance.
The ARM architecture provides independent cacheability attributes for Normal memory for two conceptual levels
of cache, the inner and the outer cache. The relationship between these conceptual levels of cache and the
implemented physical levels of cache is IMPLEMENTATION DEFINED, and can differ from the boundaries between the
Inner and Outer Shareability domains. However:
• Inner refers to the innermost caches, and always includes the lowest level of cache.
• No cache controlled by the Inner cacheability attributes can lie outside a cache controlled by the Outer
cacheability attributes.
Example A3-2, Example A3-3, and Example A3-4 describe the possible ways of implementing a system with three
levels of cache, level 1 (L1) to level 3 (L3).
Note
• L1 cache is the level closest to the processor, see Memory hierarchy on page A3-153.
• When managing coherency, system designs must consider both the inner and outer cacheability attributes, as
well as the shareability attributes. This is because hardware might have to manage the coherency of caches
at one conceptual level, even when another conceptual level has the Non-cacheable attribute.
Example A3-2 Implementation with two inner and one outer cache levels
Example A3-3 Implementation with three inner and no outer cache levels
Implement the three levels of cache in the system, L1 to L3, with the Inner cacheability attribute applied to L1, L2,
and L3 cache. Do not use the Outer cacheability attribute.
Example A3-4 Implementation with one inner and two outer cache levels
For an ARMv7-A implementation that includes the Large Physical Address Extension, it is IMPLEMENTATION
DEFINED whether a Transient attribute is supported for cacheable Normal memory regions. If an implementation
supports this attribute, the set of possible cacheability attributes for a Normal memory region becomes:
• Write-Through Cacheable, Non-transient.
A3-132 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
The cacheability attribute can be defined independently for the inner and outer levels of caching.
The transient attribute indicates that the benefit of caching is for a relatively short period, and that therefore it might
be better to restrict allocation, to avoid possibly casting-out other, less transient, entries.
Note
The architecture does not specify what is meant by a relatively short period.
The description of the MAIRn registers includes the assignment of the Transient attribute in an implementation that
supports this option.
Note
See Ordering of instructions that change the CPSR interrupt masks on page D12-2494 for additional requirements
that apply to accesses to Strongly-ordered memory in ARMv6.
Examples of memory regions normally marked as being Device or Strongly-ordered memory are Memory-mapped
peripherals and I/O locations.
For explicit accesses from the processor to memory marked as Device or Strongly-ordered:
• All accesses occur at their program size.
• The number of accesses is the number specified by the program.
An implementation must not perform more accesses to a Device or Strongly-ordered memory location than are
specified by a simple sequential execution of the program, except as a result of an exception. This section describes
this permitted effect of an exception.
The architecture does not permit speculative data accesses to memory marked as Device or Strongly-ordered.
However, it does not prohibit speculative translation table walks to Device or Strongly-ordered memory.
Note
• For an implementation that includes the Virtualization Extensions, for accesses from an application running
in Non-secure state, a speculative translation table walk to Device or Strongly-ordered memory might result
from the second stage of address translation defined by a hypervisor. For more information, see Overlaying
the memory type attribute on page B3-1372.
The architecture permits an Advanced SIMD element or structure load instruction to access bytes in Device or
Strongly-ordered memory that are not explicitly accessed by the instruction, provided the bytes accessed are in a
16-byte window, aligned to 16-bytes, that contains at least one byte that is explicitly accessed by the instruction.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-133
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
Address locations marked as Strongly-ordered, and on an implementation that includes the Large Physical Address
Extension, address locations marked as Device, are always treated as Shareable. For more information about the
effect of the Large Physical Address Extension on the shareability of these locations see Device and
Strongly-ordered memory shareability, Large Physical Address Extension on page A3-135.
On an implementation that does not include the Large Physical Address Extension, the shareability of an address
location marked as Device is configurable, as described in Shareable attribute for Device memory regions.
All explicit accesses to Device or Strongly-ordered memory must comply with the ordering requirements of
accesses described in Ordering requirements for memory accesses on page A3-146. On an implementation that does
not include the Large Physical Address Extension, the requirements for Device memory depend on the shareability
of the Device memory locations.
An instruction that generates a sequence of accesses as described in Atomicity in the ARM architecture on
page A3-125 might be abandoned as a result of an exception being taken during the sequence of accesses. On return
from the exception the instruction is restarted, and therefore one or more of the memory locations might be accessed
multiple times. This can result in repeated write accesses to a location that has been changed between the write
accesses.
Note
Software must not use an instruction that generates a sequence of accesses to access Device or Strongly-ordered
memory if the instruction might generate a synchronous Data Abort exception on any access other than the first one.
The only architecturally-required difference between Device and Strongly-ordered memory is that:
• A write to Strongly-ordered memory can complete only when it reaches the peripheral or memory component
accessed by the write.
• A write to Device memory is permitted to complete before it reaches the peripheral or memory component
accessed by the write.
Note
In addition, as described in Shareable attribute for Device memory regions, in an implementation that does not
include the Large Physical Address Extension, Device memory has Shareability attributes, the interpretation of
which is IMPLEMENTATION DEFINED, and might mean a Device memory region is not shareable.
The architecture does not permit unaligned accesses to Strongly-ordered or Device memory. Memory access
restrictions on page A3-135 summarizes the behavior of such accesses.
Some implementations make no distinction between Outer Shareable Device memory and Inner Shareable Device
memory, and refer to both memory types as Shareable Device memory.
Some implementations make no distinction between Shareable Device memory and Non-shareable Device memory,
and refer to both memory types as Shareable Device memory.
For Device memory regions, the significance of shareability is IMPLEMENTATION DEFINED. However, an example
of a system supporting Shareable and Non-shareable Device memory is an implementation that supports both:
• A local bus for its private peripherals.
• System peripherals implemented on the main shared system bus.
A3-134 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
Such a system might have more predictable access times for local peripherals such as watchdog timers or interrupt
controllers. In particular, a specific address in a Non-shareable Device memory region might access a different
physical peripheral for each processor.
ARM deprecates the marking of Device memory with a shareability attribute other than Outer Shareable or
Shareable. This means ARM strongly recommends that Device memory is never assigned a shareability attribute of
Non-shareable or Inner Shareable.
In an implementation that includes the Large Physical Address Extension and is using the Short-descriptor
translation table format:
• An address-based cache maintenance operation for an address in a region with the Strongly-ordered or
Device memory type applies to all processors in the same Outer Shareable domain, regardless of any
shareability attributes applied to the region.
• Device memory transactions to a single peripheral must not be reordered, regardless of any shareability
attributes that are applied to the corresponding Device memory region.
Any single peripheral has an IMPLEMENTATION DEFINED size of not less than 1KB.
• For accesses to any two bytes, p and q, that are generated by the same instruction:
— The bytes p and q must have the same memory type and shareability attributes, otherwise the results
are UNPREDICTABLE. For example, an LDC, LDM, LDRD, STC, STM, STRD, or unaligned load or store that spans
a boundary between Normal and Device memory is UNPREDICTABLE.
— Except for possible differences in the cache allocation hints, ARM deprecates having different
cacheability attributes for the bytes p and q.
• Unaligned data access on page A3-106 identifies the instructions that can make an unaligned memory
access, and the required configuration setting. If such an access is to Device or Strongly-ordered memory
then:
— If the implementation does not include the Virtualization Extensions, the effect is UNPREDICTABLE.
— If the implementation includes the Virtualization Extensions, the access generates an Alignment fault.
• The accesses of an instruction that causes multiple accesses to Device or Strongly-ordered memory must not
cross a 4KB address boundary, otherwise the effect is UNPREDICTABLE. For this reason, it is important that
an access to a volatile memory device is not made using a single instruction that crosses a 4KB address
boundary.
Note
This situation is UNPREDICTABLE even if the cause of the accesses is an unaligned access to Device or
Strongly-ordered memory in an implementation that includes the Virtualization Extensions.
ARM expects this restriction to impose constraints on the placing of volatile memory devices in the memory
map of a system, rather than expecting a compiler to be aware of the alignment of memory accesses.
• For any instruction that generates accesses to Device or Strongly-ordered memory, implementations must not
change the sequence of accesses specified by the pseudocode of the instruction. This includes not changing:
— How many accesses there are.
— The time order of the accesses at any particular memory-mapped peripheral.
— The data size and other properties of each access.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-135
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
In addition, processor implementations expect any attached memory system to be able to identify the memory
type of accesses, and to obey similar restrictions with regard to the number, time order, data sizes and other
properties of the accesses.
Exceptions to this rule are:
— An implementation of a processor can break this rule, provided that the original number, time order,
and other details of the accesses can be reconstructed from the information it supplies to the memory
system. In addition, the implementation must place a requirement on attached memory systems to do
this reconstruction when the accesses are to Device or Strongly-ordered memory.
For example, an implementation with a 64-bit bus might pair the word loads generated by an LDM into
64-bit accesses. This is because the instruction semantics ensure that the 64-bit access is always a word
load from the lower address followed by a word load from the higher address. However the
implementation must permit the memory systems to unpack the two word loads when the access is to
Device or Strongly-ordered memory.
— An Advanced SIMD element or structure load instruction can access bytes in Device or
Strongly-ordered memory that are not explicitly accessed by the instruction, provided the bytes
accessed are within a 16-byte window, aligned to 16-bytes, that contains at least one byte that is
explicitly accessed by the instruction.
— There is no requirement for the memory system to be able to identify the size of the elements accessed
by an Advanced SIMD element or structure load/store instruction.
• In a PMSA implementation, and in a VMSA implementation when any associated MMU is enabled, any
multi-access instruction that loads or stores the PC must access only Normal memory. If the instruction
accesses Device or Strongly-ordered memory the result is UNPREDICTABLE.
• Any instruction fetch must access only Normal memory. If it accesses Device or Strongly-ordered memory,
the result is UNPREDICTABLE.
• If a single physical memory location has more than one set of attributes assigned to it, ARM strongly
recommends that software ensures that the sets of attributes are identical. For more information see
Mismatched memory attributes.
An example of where multiple sets of attributes might be assigned to the same physical memory location is
the use of aliases in a virtual to physical address mapping.
The following rules apply when a physical memory location is accessed with mismatched attributes:
1. When a memory location is accessed with mismatched attributes the only software visible effects are one or
more of the following:
• Uniprocessor semantics for reads and writes to that memory location might be lost. This means:
— A read of the memory location by a thread of execution might not return the value most recently
written to that memory location by that thread of execution.
— Multiple writes to the memory location by a thread of execution, that use different memory
attributes, might not be ordered in program order.
• There might be a loss of coherency when multiple threads of execution attempt to access a memory
location.
• There might be a loss of properties derived from the memory type, see rule 2.
• If multiple threads of execution attempt to use Load-Exclusive or Store-Exclusive instructions to
access a location with different memory attributes, the exclusive monitor state becomes UNKNOWN.
A3-136 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
2. The loss of properties associated with mismatched memory type attributes refers only to the following
properties of Strongly-ordered or Device memory, that are additional to the properties of Normal memory:
• Prohibition of speculative accesses.
• Preservation of the size of accesses.
• Preservation of the order of accesses.
• The guarantee that the write acknowledgement comes from the endpoint of the access.
If the only memory type mismatch is between Strongly-ordered and Device memory, then the only property
that can be lost is:
• The guarantee that the write acknowledgement comes from the endpoint of the access.
3. If all aliases of a memory location that permit write access to the location assign the same shareability and
cacheability attributes to that location, and all these aliases use a definition of the shareability attribute that
includes all the threads of execution that can access the location, then any thread of execution that reads the
memory location using these shareability and cacheability attributes accesses it coherently, to the extent
required by that common definition of the memory attributes.
4. The possible loss of properties caused by mismatched attributes for a memory location are defined more
precisely if all of the mismatched attributes define the memory location as one of:
• Strongly-ordered memory.
• Device memory.
• Normal Inner Non-cacheable, Outer Non-cacheable memory.
In these cases, the only possible software-visible effects of the mismatched attributes are one or more of:
• Possible loss of properties derived from the memory type when multiple threads of execution attempt
to access the memory location.
• Possible re-ordering of memory transactions to the memory location that use different memory
attributes, potentially leading to a loss of coherency or uniprocessor semantics. Any possible loss of
coherency or uniprocessor semantics can be avoided by inserting DMB barrier instructions between
accesses to the same memory location that might use different attributes.
5. If the mismatched attributes for a memory location all assign the same shareability attribute to the location,
any loss of coherency within a shareability domain can be avoided. To do so, software must use the
techniques that are required for the software management of the coherency of cacheable locations between
threads of execution in different shareability domains. This means:
• If any thread of execution might have written to the location with the write-back attribute, before
writing to the location not using the write-back attribute, a thread of execution must invalidate, or
clean, the location from the caches. This avoids the possibility of overwriting the location with stale
data.
• After writing to the location with the write-back attribute, a thread of execution must clean the location
from the caches, to make the write visible to external memory.
• Before reading the location with a cacheable attribute, a thread of execution must invalidate the
location from the caches, to ensure that any value held in the caches reflects the last value made visible
in external memory.
In all cases:
• Location refers to any byte within the current coherency granule.
• A clean and invalidate operation can be used instead of a clean operation, or instead of an invalidate
operation.
• To ensure coherency, all cache maintenance and memory transactions must be completed, or ordered
by the use of barrier operations.
Note
With software management of coherency, race conditions can cause loss of data. A race condition occurs
when different threads of execution write simultaneously to bytes that are in the same location, and the
(invalidate or clean), write, clean sequence of one thread overlaps the equivalent sequence of another thread.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-137
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.5 Memory types and attributes and the memory order model
6. If the mismatched attributes for a location mean that multiple cacheable accesses to the location might be
made with different shareability attributes, then coherency is guaranteed only if each thread of execution that
accesses the location with a cacheable attribute performs a clean and invalidate of the location.
Note
The Note in rule 5, about possible race conditions, also applies to this rule.
ARM strongly recommends that software does not use mismatched attributes for aliases of the same location. An
implementation might not optimize the performance of a system that uses mismatched aliases.
The Secure virtual memory space is accessed by memory accesses in the Secure state, and the Non-secure virtual
memory space is accessed by memory accesses in the Non-secure state.
By providing different virtual memory spaces, the Security Extensions permit memory accesses made from the
Non-secure state to be distinguished from those made from the Secure state.
A3-138 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.6 Access rights
• Restrict data accesses, based on the privilege level of the access. See Privilege level access controls for data
accesses on page A3-140.
• Restrict instruction fetches, based on the privilege level of the process or thread making the fetch. See
Privilege level access controls for instruction accesses on page A3-140.
• On a system that implements the Security Extensions, restrict accesses so that only memory accesses with
the Secure memory attribute are permitted. See Memory region security status on page A3-141.
• In a VMSA implementation, in the MMU, see Memory access control on page B3-1352, Memory region
attributes on page B3-1362, and The effects of disabling MMUs on VMSA behavior on page B3-1312.
• In a PMSA implementation, in the MPU, see Memory access control on page B5-1753 and Memory region
attributes on page B5-1754.
The current processor mode determines the execution privilege level, and therefore the execution privilege level can
be described as the processor privilege level.
Every memory access has an access privilege, that is either unprivileged or privileged.
PL0 The privilege level of application software, that executes in User mode. Therefore, software
executed in User mode is described as unprivileged software. This software cannot access some
features of the architecture. In particular, it cannot change many of the configuration settings.
Software executing at PL0 makes only unprivileged memory accesses.
PL1 Software execution in all modes other than User mode and Hyp mode is at PL1. Normally, operating
system software executes at PL1. Software executing at PL1 can access all features of the
architecture, and can change the configuration settings for those features, except for some features
added by the Virtualization Extensions that are only accessible at PL2.
Note
In many implementation models, system software is unaware of the PL2 level of privilege, and of
whether the implementation includes the Virtualization Extensions.
The PL1 modes refers to all the modes other than User mode and Hyp mode.
Software executing at PL1 makes privileged memory accesses by default, but can also make
unprivileged accesses.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-139
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.6 Access rights
Hyp mode is implemented only as part of the Virtualization Extensions, and only in Non-secure
state. This means that:
• Implementations that do not include the Virtualization Extensions have only two privilege
levels, PL0 and PL1.
• Execution in Secure state has only two privilege levels, PL0 and PL1.
In an implementation that includes the Security Extensions, the execution privilege levels are defined independently
in each security state, and there is no relationship between the Secure and Non-secure privilege levels.
Note
The fact that Non-secure Hyp mode executes at PL2 does not indicate that it is more privileged than the Secure PL1
modes. Secure PL1 modes can change the configuration and control settings for Non-secure operation in all modes,
but Non-secure modes can never change the configuration and control settings for Secure operation.
In Non-secure state, separate memory access permissions can be assigned at PL2 for:
• Accesses made at PL1 and PL0.
• Accesses made at PL2.
The access privilege level is defined separately for explicit read and explicit write accesses. However, a system that
specifies the memory attributes is not required to support all combinations of memory attributes for read and write
accesses.
A privileged memory access is an access made during execution at PL1 or higher, as a result of a load or store
operation other than LDRT, STRT, LDRBT, STRBT, LDRHT, STRHT, LDRSHT, or LDRSBT.
An unprivileged memory access is an access made as a result of load or store operation performed in one of these
cases:
• When the processor is at PL1, and the access is made as a result of an LDRT, STRT, LDRBT, STRBT, LDRHT, STRHT,
LDRSHT, or LDRSBT instruction.
A Data Abort exception is generated if the processor attempts a data access that the access rights do not permit. For
example, a Data Abort exception is generated if the processor is at PL0 and attempts to access a memory region that
is marked as only accessible to privileged memory accesses.
• Not accessible for execution at PL1 Only implementations that include the Large Physical Address Extension
support this attribute.
A3-140 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.6 Access rights
In Non-secure state, in an implementation that includes the Virtualization Extensions, separate memory access
permissions can be assigned at PL2 for:
• Accesses made at PL1 and PL0.
• Accesses made at PL2.
To define the instruction access rights to a memory region, the memory attributes describe, separately, for the
region:
• Its read access rights. These are equivalent to the read access rights described in Privilege level access
controls for data accesses on page A3-140.
• Whether software can be executed from the region. This is indicated by whether or not an Execute-never
(XN) attribute is assigned to the region.
• For an implementation that includes the Large Physical Address Extension, whether software can be
executed at PL1 from the region. This is indicated by whether or not a Privileged execute-never (PXN)
attribute is assigned to the region.
This means that there is a linkage between the memory attributes that define the accessibility of a region to data
accesses, and those that define whether instructions can be executed from the region. For example, a region that is
accessible for execution only at PL1 or higher:
• Has the memory attribute indicating that it is accessible only to read accesses at PL1 or higher.
• If the implementation includes the Large Physical Address Extension, does not have the Privileged
execute-never attribute.
Any attempt to execute an instruction from a memory location with an applicable execute-never attribute generates
a memory fault.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-141
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.7 Virtual and physical addressing
ARMv7-A profile
The ARMv7-A memory system incorporates a Memory Management Unit (MMU), controlled by
CP15 registers. The memory system supports virtual addressing, with the MMU performing virtual
to physical address translation, in hardware, as part of program execution.
An ARMv7-A processor that implements the Virtualization Extensions provides two stages of
address translation for processes running at the Application level:
• The operating system defines the mappings from virtual addresses to intermediate physical
addresses (IPAs). When it does this, it believes it is mapping virtual addresses to physical
addresses.
• The hypervisor defines the mappings from IPAs to physical addresses. These translations are
invisible to the operating system.
For more information see About address translation on page B3-1309.
ARMv7-R profile
The ARMv7-R memory system incorporates a Memory Protection Unit (MPU), controlled by CP15
registers. The MPU does not support virtual addressing.
At the Application level, the difference between the ARMv7-A and ARMv7-R memory systems is transparent.
Regardless of which profile is implemented, an application accesses the memory map described in Address space
on page A3-104, and the implemented memory system makes the features described in this chapter available to the
application.
For a system level description of the ARMv7-A and ARMv7-R memory models see:
• Chapter B2 Common Memory System Architecture Features.
• Chapter B3 Virtual Memory System Architecture (VMSA).
• Chapter B5 Protected Memory System Architecture (PMSA).
Note
This manual does not describe the ARMv7-M profile. For details of this profile see the ARMv7-M Architecture
Reference Manual.
A3-142 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.8 Memory access order
The ARMv7 application level view of the memory attributes is described in:
• Memory types and attributes and the memory order model on page A3-123.
• Access rights on page A3-139.
When considering memory access ordering, an important feature of the ARMv7 memory model is the Shareable
memory attribute, that indicates whether a region of memory appears coherent for data accesses made by multiple
observers.
The key issues with the memory order model depend on the target audience:
• For software programmers, considering the model at the Application level, the key factor is that for accesses
to Normal memory barriers are required in some situations where the order of accesses observed by other
observers must be controlled.
• For silicon implementers, considering the model at the system level, the Strongly-ordered and Device
memory attributes place certain restrictions on the system designer in terms of what can be built and when to
indicate completion of an access.
Note
Implementations remain free to choose the mechanisms required to implement the functionality of the
memory model.
More information about the memory order model is given in the following subsections:
• Reads and writes.
• Ordering requirements for memory accesses on page A3-146.
• Memory barriers on page A3-148.
Additional attributes and behaviors relate to the memory system architecture. These features are defined in the
system level section of this manual:
• Virtual memory systems based on an MMU, described in Chapter B3 Virtual Memory System Architecture
(VMSA).
• Protected memory systems based on an MPU, described in Chapter B5 Protected Memory System
Architecture (PMSA).
Note
In these system level descriptions, some attributes are described in relation to an MMU. In general, these
descriptions can also be applied to an MPU based system.
Except where otherwise stated, the memory ordering requirements only apply to explicit memory accesses.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-143
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.8 Memory access order
Reads
Reads are defined as memory operations that have the semantics of a load.
Hardware-accelerated opcode execution by the Jazelle extension can cause a number of reads to occur, according
to the state of the operand stack and the implementation of the Jazelle hardware acceleration.
Writes
Writes are defined as memory operations that have the semantics of a store.
Hardware-accelerated opcode execution by the Jazelle extension can cause a number of writes to occur, according
to the state of the operand stack and the implementation of the Jazelle hardware acceleration.
Synchronization primitives
Synchronization primitives must ensure correct operation of system semaphores in the memory order model. The
synchronization primitive instructions are defined as those instructions that are executed to ensure memory
synchronization. They are the following instructions:
• LDREX, STREX, LDREXB, STREXB, LDREXD, STREXD, LDREXH, STREXH.
• SWP, SWPB. From ARMv6, ARM deprecates the use of these instructions.
• A mechanism that causes an instruction cache to be filled from memory or that fetches instructions to be
executed directly from memory.
The set of observers that can observe a memory access is defined by the system.
In the definitions in this subsection, subsequent means whichever of the following is appropriate to the context:
• After the point in time where the location is observed by that observer.
• After the point in time where the location is globally observed.
A3-144 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.8 Memory access order
• A write to a location in memory is said to be globally observed for a shareability domain when:
— A subsequent read of the location by any observer in that shareability domain will return the value
written by the globally observed write, or written by a write to that location by any observer that is
sequenced in the Coherence order of the location after the globally observed write.
— A subsequent write of the location by any observer in that shareability domain will be sequenced in
the Coherence order of the location after the globally observed write
• A read of a location in memory is said to be observed by an observer when a subsequent write to the location
by the same observer will have no effect on the value returned by the read.
• A read of a location in memory is said to be globally observed for a shareability domain when a subsequent
write to the location by any observer in that shareability domain will have no effect on the value returned by
the read.
• A read or write of a memory-mapped location in a peripheral that exhibits side-effects is said to be observed,
and globally observed, only when the read or write:
— Meets the general conditions listed.
— Can begin to affect the state of the memory-mapped peripheral.
— Can trigger all associated side-effects, whether they affect other peripheral devices, processors, or
memory.
Note
This definition is consistent with the memory access having reached the peripheral.
• A read or write is complete for a shareability domain when all of the following are true:
— The read or write is globally observed for that shareability domain.
— Any translation table walks associated with the read or write are complete for that shareability domain.
• A translation table walk is complete for a shareability domain when the memory accesses associated with the
translation table walk are globally observed for that shareability domain, and the TLB is updated.
• A cache, branch predictor, or TLB maintenance operation is complete for a shareability domain when the
effects of the operation are globally observed for that shareability domain, and any translation table walks
that arise from the operation are complete for that shareability domain.
The completion of any cache, branch predictor, or TLB maintenance operation includes its completion on all
processors that are affected by both the operation and the DSB operation that is required to guarantee
visibility of the maintenance operation.
The completion of a memory access to Strongly-ordered or Device memory is not guaranteed to be sufficient to
determine that the side-effects of the memory access are visible to all observers. The mechanism that ensures the
visibility of side-effects of a memory access is IMPLEMENTATION DEFINED.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-145
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.8 Memory access order
Two terms used in describing the memory access ordering requirements are:
Address dependency
An address dependency exists when the value returned by a read access is used for the computation
of the virtual address of a subsequent read or write access. An address dependency exists even if the
value read by the first read access does not change the virtual address of the second read or write
access. This might be the case if the value returned is masked off before it is used, or if it has no
effect on the predicted address value for the second access.
Control dependency
A control dependency exists when the data value returned by a read access determines the condition
flags, and the values of the flags are used in the condition code checking that determines the address
of a subsequent read access. This address determination might be through conditional execution, or
through the evaluation of a branch.
Figure A3-5 shows the memory ordering between two explicit accesses A1 and A2, where A1 occurs before A2 in
program order. In the figure, an access refers to a read or a write access to the specified memory type. For example,
Normal access refers to a read or write access to Normal memory. The symbols used in the figure are as follows:
< Accesses must arrive at any particular memory-mapped peripheral or block of memory in program
order, that is, A1 must arrive before A2. There are no ordering restrictions about when accesses
arrive at different peripherals or blocks of memory, provided that accesses follow the general
ordering rules given in this section.
- Accesses can arrive at any memory-mapped peripheral or block of memory in any order, provided
that the accesses follow the general ordering rules given in this section.
The size of a memory mapped peripheral, or a block of memory, is IMPLEMENTATION DEFINED, but is not smaller
than 1KByte.
Note
This implies that the maximum memory-mapped peripheral size for which the architecture guarantees order for all
implementations is 1KB.
There are no ordering requirements for implicit accesses to any type of memory.
The following additional restrictions apply to the ordering of all memory accesses:
• For all accesses from a single observer, the requirements of uniprocessor semantics must be maintained, for
example:
— Respecting dependencies between instructions in a single processor.
— Coherency.
• If there is an address dependency then the two memory accesses are observed in program order by any
observer in the common shareability domain of the two accesses.
A3-146 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.8 Memory access order
This ordering restriction does not apply if there is only a control dependency between the two read accesses.
If there is both an address dependency and a control dependency between two read accesses the ordering
requirements of the address dependency apply.
• If the value returned by a read access is used as data written by a subsequent write access, then the two
memory accesses are observed in program order by any observer in the common shareability domain of the
two accesses.
• The only stores by an observer that can be observed by another observer are those stores that have been
Architecturally executed. Speculative writes by an observer cannot be observed by another observer. For the
purposes of this requirement, speculative writes are all of:
— Writes generated by store instructions that appear in the Execution stream after a branch that is not
architecturally resolved.
— Writes generated by store instructions that appear in the Execution stream after an instruction where a
synchronous exception condition has not been architecturally resolved.
— Writes generated by conditional store instructions for which the conditions for the instruction have not
been architecturally resolved.
— Writes generated by store instructions for which the data being written comes from a register that has
not been architecturally committed.
• It is impossible for an observer in the shareability domain of a memory location to observe two reads to the
same memory location performed by the same observer in an order that would not occur in a sequential
execution of a program.
• For an implementation that does not include the Multiprocessing Extensions, it is IMPLEMENTATION DEFINED
whether all writes complete in a finite period of time, or whether some writes require the execution of a DSB
instruction to guarantee their completion.
• For an implementation that includes the Multiprocessing Extensions, all writes complete in a finite period of
time.
Note
This applies for all writes, including repeated writes to the same location.
Load/store multiple instructions, such as LDM, LDRD, STM, and STRD, generate multiple word accesses, each of which is
a separate access for the purpose of determining ordering.
The rules for determining program order for two accesses A1 and A2 are:
• If A1 and A2 are the load and store generated by a SWP or SWPB instruction:
— A1 < A2 if A1 is the load and A2 is the store.
— A2 < A1 if A2 is the load and A1 is the store.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-147
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.8 Memory access order
• In these descriptions:
— An LDM-class instruction is any form of LDM, LDMDA, LDMDB, or LDMIB, or a POP instruction that operates
on more than one register.
— An LDC-class instruction is an LDC, VLDM, VLDR, or VPOP instruction.
— An STM-class instruction is any form of STM, STMDA, STMDB, or STMIB, or a PUSH instruction that operates
on more than one register.
— An STC-class instruction is an STC, VSTM, VSTR, or VPUSH instruction.
If A1 and A2 are two word loads generated by an LDC-class or LDM-class instruction, or two word stores
generated by an STC-class or STM-class instruction, excluding LDM-class and STM-class instructions with
a register list that includes the PC:
— A1 <= A2 if the address of A1 is less than the address of A2.
— A2 <= A1 if the address of A2 is less than the address of A1.
If A1 and A2 are two word loads generated by an LDM-class instruction with a register list that includes the
PC or two word stores generated by an STM-class instruction with a register list that includes the PC, the
program order of the memory accesses is not defined.
• If A1 and A2 are two word loads generated by an LDRD instruction or two word stores generated by an STRD
instruction, the program order of the memory accesses is not defined.
• If A1 and A2 are load or store accesses generated by Advanced SIMD element or structure load/store
instructions, the program order of the memory accesses is not defined.
• For any instruction or operation not explicitly mentioned in this section, if the single-copy atomicity rules
described in Single-copy atomicity on page A3-125 mean the operation becomes a sequence of accesses, then
the time-ordering of those accesses is not defined.
ARMv7 and ARMv6 require three explicit memory barriers to support the memory order model described in this
chapter. In ARMv7 the memory barriers are provided as instructions that are available in the ARM and Thumb
instruction sets, and in ARMv6 the memory barriers are performed by CP15 register writes. The three memory
barriers are:
• Data Memory Barrier, see Data Memory Barrier (DMB) on page A3-149.
• Data Synchronization Barrier, see Data Synchronization Barrier (DSB) on page A3-150.
• Instruction Synchronization Barrier, see Instruction Synchronization Barrier (ISB) on page A3-150.
Note
Depending on the required synchronization, a program might use memory barriers on their own, or it might use them
in conjunction with cache and memory management maintenance operations that are only available when software
execution is at PL1 or higher.
The DMB and DSB memory barriers affect reads and writes to the memory system generated by load/store
instructions and data or unified cache maintenance operations being executed by the processor. Instruction fetches
or accesses caused by a hardware translation table access are not explicit accesses.
A3-148 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.8 Memory access order
Group A Contains:
• All explicit memory accesses of the required access types from observers in the same
required shareability domain as Pe that are observed by Pe before the DMB instruction. These
accesses include any accesses of the required access types performed by Pe.
• All loads of required access types from an observer Px in the same required shareability
domain as Pe that have been observed by any given different observer, Py, in the same
required shareability domain as Pe before Py has performed a memory access that is a
member of Group A.
Group B Contains:
• All explicit memory accesses of the required access types by Pe that occur in program order
after the DMB instruction.
• All explicit memory accesses of the required access types by any given observer Px in the
same required shareability domain as Pe that can only occur after a load by Px has returned
the result of a store that is a member of Group B.
Any observer with the same required shareability domain as Pe observes all members of Group A before it observes
any member of Group B to the extent that those group members are required to be observed, as determined by the
shareability and cacheability of the memory locations accessed by the group members.
Where members of Group A and members of Group B access the same memory-mapped peripheral of arbitrary
system-defined size, then members of Group A that are accessing Strongly-ordered, Device, or Normal
Non-cacheable memory arrive at that peripheral before members of Group B that are accessing Strongly-ordered,
Device, or Normal Non-cacheable memory. If the memory accesses are not to a peripheral, then there are no
restrictions from this paragraph.
Note
• Where the members of Group A and Group B that must be ordered are from the same processor, a DMB NSH is
sufficient for this guarantee.
• A memory access might be in neither Group A nor Group B. The DMB does not affect the order of
observation of such a memory access.
• The second part of the definition of Group A is recursive. Ultimately, membership of Group A derives from
the observation by Py of a load before Py performs an access that is a member of Group A as a result of the
first part of the definition of Group A.
• The second part of the definition of Group B is recursive. Ultimately, membership of Group B derives from
the observation by any observer of an access by Pe that is a member of Group B as a result of the first part of
the definition of Group B.
DMB only affects memory accesses and data and unified cache maintenance operations, see Cache and branch
predictor maintenance operations on page B2-1276. It has no effect on the ordering of any other instructions
executing on the processor.
For details of the DMB instruction in the Thumb and ARM instruction sets, see DMB on page A8-379.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-149
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.8 Memory access order
A DSB behaves as a DMB with the same arguments, and also has the additional properties defined here.
A DSB completes when:
• All explicit memory accesses that are observed by Pe before the DSB is executed, are of the required access
types, and are from observers in the same required shareability domain as Pe, are complete for the set of
observers in the required shareability domain.
• If the required accesses types of the DSB is reads and writes, all cache and branch predictor maintenance
operations issued by Pe before the DSB are complete for the required shareability domain.
• If the required accesses types of the DSB is reads and writes, all TLB maintenance operations issued by Pe
before the DSB are complete for the required shareability domain.
In addition, no instruction that appears in program order after the DSB instruction can execute until the DSB completes.
For details of the DSB instruction in the Thumb and ARM instruction sets, see DSB on page A8-381.
Note
Historically, this operation was referred to as Drain Write Buffer or Data Write Barrier (DWB). From ARMv6, these
names and the use of DWB were deprecated in favor of the new Data Synchronization Barrier name and DSB
abbreviation. DSB better reflects the functionality provided from ARMv6, because DSB is architecturally defined
to include all cache, TLB and branch prediction maintenance operations as well as explicit memory operations.
Any context-changing operations appearing in program order after the ISB instruction only take effect after the ISB
has been executed.
For more information about the ISB instruction in the Thumb and ARM instruction sets, see ISB on page A8-390.
A3-150 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.8 Memory access order
By default, each instruction operates for read and write accesses, over the full system, and whether an
implementation supports any other options is IMPLEMENTATION DEFINED. See the instruction descriptions for more
information about these arguments.
Note
ISB also supports an optional limitation argument, but supports only one value for that argument, that corresponds
to full system operation.
In an implementation that includes the Virtualization Extensions, and supports shareability limitations on the data
barrier operations, the HCR.BSU field can upgrade the required shareability of the operation for an instruction that
is executed in a Non-secure PL1 or PL0 mode. Table A3-6 shows the encoding of this field:
01 Inner Shareable
10 Outer Shareable
11 Full system
For an instruction executed in a Non-secure PL1 or PL0 mode, Table A3-7 shows how HCR.BSU upgrades the
shareability specified by the argument of the DMB or DSB instruction:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-151
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.8 Memory access order
InstructionSynchronizationBarrier()
A3-152 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.9 Caches and memory hierarchy
Caches increase the average speed of a memory access. Cache operation takes account of two principles of locality:
Spatial locality
An access to one location is likely to be followed by accesses to adjacent locations. Examples of this
principle are:
• Sequential instruction execution.
• Accessing a data structure.
Temporal locality
An access to an area of memory is likely to be repeated in a short time period. An example of this
principle is the execution of a software loop.
To minimize the quantity of control information stored, the spatial locality property groups several locations
together under the same tag. This logical block is commonly called a cache line. When data is loaded into a cache,
access times for subsequent loads and stores are reduced, resulting in overall performance benefits. An access to
information already in a cache is called a cache hit, and other accesses are called cache misses.
Normally, caches are self-managing, with the updates occurring automatically. Whenever the processor wants to
access a cacheable location, the cache is checked. If the access is a cache hit, the access occurs in the cache,
otherwise a location is allocated and the cache line loaded from memory. Different cache topologies and access
policies are possible, however, they must comply with the memory coherency model of the underlying architecture.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-153
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.9 Caches and memory hierarchy
Virtual
address Address Physical address
translation
CP15 configuration
and control
Note
In this manual, in a hierarchical memory system, Level 1 refers to the level closest to the processor, as shown in
Figure A3-6.
• When memory updates made from the application software must be made visible to other agents in the
system.
For example:
• In a system with a DMA controller that reads memory locations that are held in the data cache of a processor,
a breakdown of coherency occurs when the processor has written new data in the data cache, but the DMA
controller reads the old data held in memory.
• In a Harvard architecture of caches, where there are separate instruction and data caches, a breakdown of
coherency occurs when new instruction data has been written into the data cache, but the instruction cache
still contains the old instruction data.
• By not using the caches in situations where coherency issues can arise. This can be achieved by:
— Using Non-cacheable or, in some cases, Write-Through Cacheable memory.
— Not enabling caches in the system.
• By using cache maintenance operations to manage the coherency issues in software, see About ARMv7 cache
and branch predictor maintenance functionality on page B2-1272. Many of these operations are only
available to system software.
• By using hardware coherency mechanisms to ensure the coherency of data accesses to memory for cacheable
locations by observers within the different shareability domains, see Non-shareable Normal memory on
page A3-129 and Shareable, Inner Shareable, and Outer Shareable Normal memory on page A3-130.
A3-154 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A3 Application Level Memory Model
A3.9 Caches and memory hierarchy
• The processor might have fetched the instructions from memory at any time since the last context
synchronization operation on that processor.
• Any instructions fetched in this way might be executed multiple times, if this is required by the execution of
the program, without being refetched from memory.
Note
See Context synchronization operation for the definition of this term.
In addition, the ARM architecture does not require the hardware to ensure coherency between instruction caches
and memory, even for regions of memory with Shareable attributes. This means that for cacheable regions of
memory, an instruction cache can hold instructions that were fetched from memory before the context
synchronization operation.
If software requires coherency between instruction execution and memory, it must manage this coherency using the
ISB and DSB memory barriers and cache maintenance operations, see Ordering of cache and branch predictor
maintenance operations on page B2-1287. Many of these operations are only available to system software.
The Preload instructions are hints, and so implementations can treat them as NOPs without affecting the functional
behavior of the device. The instructions do not generate synchronous Data Abort exceptions, but the memory system
operations might, under exceptional circumstances, generate asynchronous aborts. For more information, see Data
Abort exception on page B1-1214.
For more information about the operation of these instructions, see Behavior of Preload Data (PLD, PLDW) and
Preload Instruction (PLI) with caches on page B2-1267.
Hardware implementations can provide other implementation-specific mechanisms to fetch memory locations in
the cache. These must comply with the general cache behavior described in Cache behavior on page B2-1265.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A3-155
ID040418 Non-Confidential
A3 Application Level Memory Model
A3.9 Caches and memory hierarchy
A3-156 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A4
The Instruction Sets
This chapter describes the ARM and Thumb instruction sets. It contains the following sections:
• About the instruction sets on page A4-158.
• Unified Assembler Language on page A4-160.
• Branch instructions on page A4-162.
• Data-processing instructions on page A4-163.
• Status register access instructions on page A4-172.
• Load/store instructions on page A4-173.
• Load/store multiple instructions on page A4-175.
• Miscellaneous instructions on page A4-176.
• Exception-generating and exception-handling instructions on page A4-177.
• Coprocessor instructions on page A4-178.
• Advanced SIMD and Floating-point load/store instructions on page A4-179.
• Advanced SIMD and Floating-point register transfer instructions on page A4-181.
• Advanced SIMD data-processing instructions on page A4-182.
• Floating-point data-processing instructions on page A4-189.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-157
ID040418 Non-Confidential
A4 The Instruction Sets
A4.1 About the instruction sets
• Thumb instructions are either 16-bit or 32-bit, and are aligned on a two-byte boundary. 16-bit and 32-bit
instructions can be intermixed freely. Many common operations are most efficiently executed using 16-bit
instructions. However:
— Most 16-bit instructions can only access the first eight of the ARM core registers, R0-R7. These are
called the low registers. A small number of 16-bit instructions can also access the high registers,
R8-R15.
— Many operations that would require two or more 16-bit instructions can be more efficiently executed
with a single 32-bit instruction.
— All 32-bit instructions can access all of the ARM core registers, R0-R15.
• ARM instructions are always 32-bit, and are aligned on a four-byte boundary.
The ARM and Thumb instruction sets can interwork freely, that is, different procedures can be compiled or
assembled to different instruction sets, and still be able to call each other efficiently.
ThumbEE is a variant of the Thumb instruction set that is designed as a target for dynamically generated code.
However, it cannot interwork freely with the ARM and Thumb instruction sets.
In an implementation that includes a non-trivial Jazelle Extension, the processor can execute some Java bytecodes
in hardware. For more information, see Jazelle direct bytecode execution support on page A2-96. The processor
executes Java bytecodes when it is in Jazelle state. However, this execution is outside the scope of this manual.
See:
• Chapter A5 ARM Instruction Set Encoding for encoding details of the ARM instruction set.
• Chapter A6 Thumb Instruction Set Encoding for encoding details of the Thumb instruction set.
• Chapter A8 Instruction Descriptions for detailed descriptions of the instructions.
• Chapter A9 The ThumbEE Instruction Set for encoding details of the ThumbEE instruction set.
In ARMv7, a processor in ARM state can also enter Thumb state by executing an ADC, ADD, AND, ASR, BIC, EOR, LSL,
LSR, MOV, MVN, ORR, ROR, RRX, RSB, RSC, SBC, or SUB instruction that has the PC as destination register and does not set the
condition flags.
Note
This permits calls and returns between ARM code written for ARMv4 processors and Thumb code running on
ARMv7 processors to function correctly. ARM recommends that new software uses BX or BLX instructions instead.
In particular, ARM recommends that software uses BX LR to return from a procedure, not MOV PC, LR.
The target instruction set is either encoded directly in the instruction (for the immediate offset version of BLX), or is
held as bit[0] of an interworking address. For details, see the description of the BXWritePC() function in Pseudocode
details of operations on ARM core registers on page A2-46.
Exception entries and returns can also change between ARM and Thumb states. For details see Exception handling
on page B1-1164.
A4-158 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.1 About the instruction sets
In the ARM instruction set, conditional execution means that an instruction only has its normal effect on the
programmers’ model operation, memory and coprocessors if the N, Z, C and V condition flags in the APSR satisfy
a condition specified by the cond field in the instruction encoding. If the flags do not satisfy this condition, the
instruction acts as a NOP, that is, execution advances to the next instruction as normal, including any relevant checks
for exceptions being taken, but has no other effect.
• For the following Thumb encodings, conditional execution is controlled in a similar way to the ARM
instructions:
— A 16-bit conditional branch instruction encoding, with a branch range of –256 to +254 bytes. Before
ARMv6T2, this was the only mechanism for conditional execution in Thumb code.
— A 32-bit conditional branch instruction encoding, with a branch range of approximately ±1MB.
For more information about these encodings, see B on page A8-332.
• The CBZ and CBNZ instructions, Compare and Branch on Zero, and Compare and Branch on Nonzero, are 16-bit
conditional instructions with a branch range of +4 to +130 bytes. For details see CBNZ, CBZ on page A8-354.
• The 16-bit If-Then instruction makes up to four following instructions conditional, and can make most other
Thumb instructions conditional. For details, see IT on page A8-391. The instructions that are made
conditional by an IT instruction are called its IT block. For any IT block, either:
— All instructions have the same condition.
— Some instructions have one condition, and the other instructions have the inverse condition.
ARM deprecates the conditional execution of any instruction encoding provided by the Advanced SIMD Extension
that is not also provided by the Floating-point (VFP) Extension, and strongly recommends that any such instruction
that can be conditionally executed is specified with the <c> field omitted or set to AL. For more information, see
Conditional execution on page A8-286.
For more information about conditional execution, see Conditional execution on page A8-286.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-159
ID040418 Non-Confidential
A4 The Instruction Sets
A4.2 Unified Assembler Language
UAL describes the syntax for the mnemonic and the operands of each instruction. In addition, it assumes that
instructions and data items can be given labels. It does not specify the syntax to be used for labels, nor what
assembler directives and options are available. See your assembler documentation for these details.
Most earlier ARM assembly language mnemonics are still supported as synonyms, as described in the instruction
details.
Note
Most earlier Thumb assembly language mnemonics are not supported. For more information, see Appendix D8
Legacy Instruction Mnemonics.
UAL includes instruction selection rules that specify which instruction encoding is selected when more than one
can provide the required functionality. For example, both 16-bit and 32-bit encodings exist for an ADD R0, R1, R2
instruction. The most common instruction selection rule is that when both a 16-bit encoding and a 32-bit encoding
are available, the 16-bit encoding is selected, to optimize code density.
Syntax options exist to override the normal instruction selection rules and ensure that a particular encoding is
selected. These are useful when disassembling code, to ensure that subsequent assembly produces the original code,
and in some other situations.
• IT instructions are written before conditional instructions in the correct way for the Thumb instruction set.
• When assembling to the ARM instruction set, assemblers check that any IT instructions are correct, but do
not generate any code for them.
Although other Thumb instructions are unconditional, all instructions that are made conditional by an IT instruction
must be written with a condition. These conditions must match the conditions imposed by the IT instruction. For
example, an ITTEE EQ instruction imposes the EQ condition on the first two following instructions, and the NE
condition on the next two. Those four instructions must be written with EQ, EQ, NE and NE conditions respectively.
Some instructions cannot be made conditional by an IT instruction. Some instructions can be conditional if they are
the last instruction in the IT block, but not otherwise.
The branch instruction encodings that include a condition code field cannot be made conditional by an IT
instruction. If the assembler syntax indicates a conditional branch that correctly matches a preceding IT instruction,
it is assembled using a branch instruction encoding that does not include a condition code field.
1. Calculate the PC or Align(PC, 4) value of the instruction. The PC value of an instruction is its address plus 4
for a Thumb instruction, or plus 8 for an ARM instruction. The Align(PC, 4) value of an instruction is its PC
value ANDed with 0xFFFFFFFC to force it to be word-aligned. There is no difference between the PC and
Align(PC, 4) values for an ARM instruction, but there can be for a Thumb instruction.
2. Calculate the offset from the PC or Align(PC, 4) value of the instruction to the address of the labeled
instruction or literal data item.
3. Assemble a PC-relative encoding of the instruction, that is, one that reads its PC or Align(PC, 4) value and
adds the calculated offset to form the required address.
A4-160 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.2 Unified Assembler Language
Note
For instructions that can encode a subtraction operation, if the instruction cannot encode the calculated offset
but can encode minus the calculated offset, the instruction encoding specifies a subtraction of minus the
calculated offset.
• B, BL, and BLX (immediate). The assembler syntax for these instructions always specifies the label of the
instruction that they branch to. Their encodings specify a sign-extended immediate offset that is added to the
PC value of the instruction to form the target address of the branch.
• CBNZ and CBZ. The assembler syntax for these instructions always specifies the label of the instruction that they
branch to. Their encodings specify a zero-extended immediate offset that is added to the PC value of the
instruction to form the target address of the branch. They do not support backward branches.
• LDC, LDC2, LDR, LDRB, LDRD, LDRH, LDRSB, LDRSH, PLD, PLDW, PLI, and VLDR. The normal assembler syntax of these
load instructions can specify the label of a literal data item that is to be loaded. The encodings of these
instructions specify a zero-extended immediate offset that is either added to or subtracted from the
Align(PC, 4) value of the instruction to form the address of the data item. A few such encodings perform a
fixed addition or a fixed subtraction and must only be used when that operation is required, but most contain
a bit that specifies whether the offset is to be added or subtracted.
When the assembler calculates an offset of 0 for the normal syntax of these instructions, it must assemble an
encoding that adds 0 to the Align(PC, 4) value of the instruction. Encodings that subtract 0 from the Align(PC,
4) value cannot be specified by the normal syntax.
There is an alternative syntax for these instructions that specifies the addition or subtraction and the
immediate offset explicitly. In this syntax, the label is replaced by [PC, #+/-<imm>], where:
+/- Is + or omitted to specify that the immediate offset is to be added to the Align(PC, 4) value, or -
if it is to be subtracted.
<imm> Is the immediate offset.
This alternative syntax makes it possible to assemble the encodings that subtract 0 from the Align(PC, 4)
value, and to disassemble them to a syntax that can be re-assembled correctly.
• ADR. The normal assembler syntax for this instruction can specify the label of an instruction or literal data item
whose address is to be calculated. Its encoding specifies a zero-extended immediate offset that is either added
to or subtracted from the Align(PC, 4) value of the instruction to form the address of the data item, and some
opcode bits that determine whether it is an addition or subtraction.
When the assembler calculates an offset of 0 for the normal syntax of this instruction, it must assemble the
encoding that adds 0 to the Align(PC, 4) value of the instruction. The encoding that subtracts 0 from the
Align(PC, 4) value cannot be specified by the normal syntax.
There is an alternative syntax for this instruction that specifies the addition or subtraction and the immediate
value explicitly, by writing them as additions ADD <Rd>, PC, #<imm> or subtractions SUB <Rd>, PC, #<imm>.
This alternative syntax makes it possible to assemble the encoding that subtracts 0 from the Align(PC, 4)
value, and to disassemble it to a syntax that can be re-assembled correctly.
Note
ARM recommends that where possible, software avoids using:
• The alternative syntax for the ADR, LDC, LDC2, LDR, LDRB, LDRD, LDRH, LDRSB, LDRSH, PLD, PLI, PLDW, and VLDR
instructions.
• The encodings of these instructions that subtract 0 from the Align(PC, 4) value.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-161
ID040418 Non-Confidential
A4 The Instruction Sets
A4.3 Branch instructions
Compare and Branch on Nonzero, CBNZ, CBZ on page A8-354 0-126 bytes a
Compare and Branch on Zero
Call a subroutine, optionally change instruction set BLX (register) on page A8-348 Any Any
Branch to target address, change instruction set BX on page A8-350 Any Any
Table Branch (byte offsets) TBB, TBH on page A8-737 0-510 bytes a
Branches to loaded and calculated addresses can be performed by LDR, LDM and data-processing instructions. For
details, see Load/store instructions on page A4-173, Load/store multiple instructions on page A4-175, Standard
data-processing instructions on page A4-163, and Shift instructions on page A4-165.
• In the ARM instruction set, a data-processing instruction that targets the PC behaves as a branch instruction.
For more information, see Data-processing instructions on page A4-163.
• In the ARM and Thumb instruction sets, a load instruction that targets the PC behaves as a branch instruction.
For more information, see Load/store instructions on page A4-173.
A4-162 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.4 Data-processing instructions
For extension data-processing instructions, see Advanced SIMD data-processing instructions on page A4-182 and
Floating-point data-processing instructions on page A4-189.
• A modified immediate constant that uses 12 bits of the instruction to encode a range of constants. Thumb and
ARM instructions have slightly different ranges of modified immediate constants. For more information, see
Modified immediate constants in Thumb instructions on page A6-230 and Modified immediate constants in
ARM instructions on page A5-197.
If the second operand is another register, it can optionally be shifted in any of the following ways:
LSL Logical Shift Left by 1-31 bits.
LSR Logical Shift Right by 1-32 bits.
ASR Arithmetic Shift Right by 1-32 bits.
ROR Rotate Right by 1-31 bits.
RRX Rotate Right with Extend. For details see Shift and rotate operations on page A2-41.
In Thumb code, the amount to shift by is always a constant encoded in the instruction. In ARM code, the amount to
shift by is either a constant encoded in the instruction, or the value of a register, Rs.
For instructions other than CMN, CMP, TEQ, and TST, the result of the data-processing operation is placed in the
destination register. In the ARM instruction set, the destination register can be the PC, causing the result to be treated
as a branch address. In the Thumb instruction set, this is only permitted for some 16-bit forms of the ADD and MOV
instructions.
These instructions can optionally set the condition flags, according to the result of the operation. If they do not set
the flags, existing flag settings from a previous instruction are preserved.
Table A4-2 on page A4-164 summarizes the main data-processing instructions in the Thumb and ARM instruction
sets. Generally, each of these instructions is described in three sections in Chapter A8 Instruction Descriptions, one
section for each of the following:
• INSTRUCTION (register) where the second operand is a register, or a register shifted by a constant.
• INSTRUCTION (register-shifted register) where the second operand is a register shifted by a value obtained from
another register. These are only available in the ARM instruction set.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-163
ID040418 Non-Confidential
A4 The Instruction Sets
A4.4 Data-processing instructions
Add ADD Thumb instruction set permits use of a modified immediate constant or a
zero-extended 12-bit immediate constant.
Form PC-relative Address ADR First operand is the PC. Second operand is an immediate constant. Thumb instruction
set uses a zero-extended 12-bit immediate constant. Operation is an addition or a
subtraction.
Compare Negative CMN Sets flags. Like ADD but with no destination register.
Compare CMP Sets flags. Like SUB but with no destination register.
Copy operand to destination MOV Has only one operand, with the same options as the second operand in most of these
instructions. If the operand is a shifted register, the instruction is an LSL, LSR, ASR, or
ROR instruction instead. For details, see Shift instructions on page A4-165.
The ARM and Thumb instruction sets permit use of a modified immediate constant
or a zero-extended 16-bit immediate constant.
Bitwise NOT MVN Has only one operand, with the same options as the second operand in most of these
instructions.
Bitwise OR ORR -
Reverse Subtract RSB Subtracts first operand from second operand. This permits subtraction from constants
and shifted registers.
Reverse Subtract with Carry RSC Not available in the Thumb instruction set.
Subtract SUB Thumb instruction set permits use of a modified immediate constant or a
zero-extended 12-bit immediate constant.
Test Equivalence TEQ Sets flags. Like EOR but with no destination register.
Test TST Sets flags. Like AND but with no destination register.
A4-164 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.4 Data-processing instructions
Instruction See
In the ARM instruction set only, the destination register of these instructions can be the PC, causing the result to be
treated as an address to branch to.
• Table A4-4 summarizes the multiply instructions where there is no distinction between signed and unsigned
quantities.
The least significant 32 bits of the result are used. More significant bits are discarded.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-165
ID040418 Non-Confidential
A4 The Instruction Sets
A4.4 Data-processing instructions
a. The most significant 32 bits of the 48-bit product are used. Less significant bits are discarded.
b. The most significant 32 bits of the 64-bit product are used. Less significant bits are discarded.
A4-166 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.4 Data-processing instructions
Signed Saturate SSAT on page A8-653 Saturates optionally shifted 32-bit value to selected range
Signed Saturate 16 SSAT16 on page A8-655 Saturates two 16-bit values to selected range
Unsigned Saturate USAT on page A8-797 Saturates optionally shifted 32-bit value to selected range
Unsigned Saturate 16 USAT16 on page A8-799 Saturates two 16-bit values to selected range
Saturating Add QADD on page A8-541 Add, saturating result to the 32-bit signed integer range
Saturating Subtract QSUB on page A8-555 Subtract, saturating result to the 32-bit signed integer range
Saturating Double and Add QDADD on page A8-549 Doubles one value and adds a second value, saturating the doubling and
the addition to the 32-bit signed integer range
Saturating Double and QDSUB on page A8-551 Doubles one value and subtracts the result from a second value, saturating
Subtract the doubling and the subtraction to the 32-bit signed integer range
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-167
ID040418 Non-Confidential
A4 The Instruction Sets
A4.4 Data-processing instructions
Signed Extend and Add Byte SXTAB on page A8-725 Extend 8 bits to 32 and add
Signed Extend and Add Byte 16 SXTAB16 on page A8-727 Dual extend 8 bits to 16 and add
Signed Extend and Add Halfword SXTAH on page A8-729 Extend 16 bits to 32 and add
Unsigned Extend and Add Byte UXTAB on page A8-807 Extend 8 bits to 32 and add
Unsigned Extend and Add Byte 16 UXTAB16 on page A8-809 Dual extend 8 bits to 16 and add
Unsigned Extend and Add Halfword UXTAH on page A8-811 Extend 16 bits to 32 and add
A4-168 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.4 Data-processing instructions
These instructions consist of a prefix followed by a main instruction mnemonic. The prefixes are as follows:
S Signed arithmetic modulo 28 or 216.
Q Signed saturating arithmetic.
SH Signed arithmetic, halving the results.
U Unsigned arithmetic modulo 28 or 216.
UQ Unsigned saturating arithmetic.
UH Unsigned arithmetic, halving the results.
ADD16 Adds the top halfwords of two operands to form the top halfword of the result, and the bottom
halfwords of the same two operands to form the bottom halfword of the result.
ASX Exchanges halfwords of the second operand, and then adds top halfwords and subtracts bottom
halfwords.
SAX Exchanges halfwords of the second operand, and then subtracts top halfwords and adds bottom
halfwords.
SUB16 Subtracts each halfword of the second operand from the corresponding halfword of the first operand
to form the corresponding halfword of the result.
ADD8 Adds each byte of the second operand to the corresponding byte of the first operand to form the
corresponding byte of the result.
SUB8 Subtracts each byte of the second operand from the corresponding byte of the first operand to form
the corresponding byte of the result.
The instruction set permits all 36 combinations of prefix and main instruction operand, as Table A4-10 shows.
See also Advanced SIMD parallel addition and subtraction on page A4-183.
ADD16, add, two halfwords SADD16 QADD16 SHADD16 UADD16 UQADD16 UHADD16
ASX, add and subtract with exchange SASX QASX SHASX UASX UQASX UHASX
SAX, subtract and add with exchange SSAX QSAX SHSAX USAX UQSAX UHSAX
SUB16, subtract, two halfwords SSUB16 QSUB16 SHSUB16 USUB16 UQSUB16 UHSUB16
ADD8, add, four bytes SADD8 QADD8 SHADD8 UADD8 UQADD8 UHADD8
SUB8, subtract, four bytes SSUB8 QSUB8 SHSUB8 USUB8 UQSUB8 UHSUB8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-169
ID040418 Non-Confidential
A4 The Instruction Sets
A4.4 Data-processing instructions
Note
• The Virtualization Extensions introduce the requirement for an ARMv7-A implementation to include SDIV
and UDIV.
• The ARMv7-M profile also includes the SDIV and UDIV instructions.
In the ARMv7-R profile, the SCTLR.DZ bit enables divide by zero fault detection:
SCTLR.DZ == 0 Divide-by-zero returns a zero result.
SCTLR.DZ == 1 SDIV and UDIV generate an Undefined Instruction exception on a divide-by-zero.
The SCTLR.DZ bit is cleared to zero on reset.
In an ARMv7-A profile implementation that supports the SDIV and UDIV instructions, divide-by-zero always returns
a zero result.
Any implementation of the Virtualization Extensions must include the SDIV and UDIV instructions in the Thumb and
ARM instruction sets.
In the ARMv7-R profile, the implementation of SDIV and UDIV in the ARM instruction set is OPTIONAL.
In an ARMv7-A implementation that does not include the Virtualization Extensions, the implementation of SDIV and
UDIV in both instruction sets is OPTIONAL, but the architecture permits an ARMv7-A implementation to not
implement SDIV and UDIV.
Note
Previous issues of this document have stated that a VMSAv7 implementation might implement SDIV and UDIV in the
Thumb instruction set but not in the ARM instruction set. ARM strongly recommends against this implementation
option.
The ID_ISAR0.Divide_instrs field indicates the level of support for these instructions, see ID_ISAR0, Instruction
Set Attribute Register 0, VMSA on page B4-1603 or ID_ISAR0, Instruction Set Attribute Register 0, PMSA on
page B6-1848:
• A field value of 0b0001 indicates they are implemented in the Thumb instruction set.
• A field value of 0b0010 indicates they are implemented in both the Thumb and ARM instruction sets.
A4-170 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.4 Data-processing instructions
Move Top MOVT on page A8-492 Moves 16-bit immediate value to top
halfword. Bottom halfword unchanged.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-171
ID040418 Non-Confidential
A4 The Instruction Sets
A4.5 Status register access instructions
The Application Program Status Register (APSR) on page A2-49 described the APSR.
The condition flags in the APSR are normally set by executing data-processing instructions, and normally control
the execution of conditional instructions. However, software can set the condition flags explicitly using the MSR
instruction, and can read the current state of the condition flags explicitly using the MRS instruction.
At system level, software can also:
• Use these instructions to access the SPSR of the current mode.
• Use the CPS instruction to change the CPSR.M field and the CPSR.{A, I, F} interrupt mask bits.
For details of the system level use of status register access instructions CPS, MRS, and MSR, see:
• CPS (Thumb) on page B9-1964.
• CPS (ARM) on page B9-1966.
• MRS on page B9-1976.
• MSR (immediate) on page B9-1982.
• MSR (register) on page B9-1984.
Note
These are system level instructions.
A4-172 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.6 Load/store instructions
Load/store instructions have several options for addressing memory. For more information, see Addressing modes
on page A4-174.
Halfword and byte loads load 16 bits or 8 bits from memory into the least significant halfword or byte of a register.
Unsigned loads zero-extend the loaded value to 32 bits, and signed loads sign-extend the value to 32 bits.
The Load unprivileged and Store unprivileged instructions are UNPREDICTABLE if executed at PL2.
For more information, see Privilege level access controls for data accesses on page A3-140.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-173
ID040418 Non-Confidential
A4 The Instruction Sets
A4.6 Load/store instructions
The base register can be any one of the ARM core registers R0-R12, SP, or LR.
For loads, the base register can be the PC. This permits PC-relative addressing for position-independent code.
Instructions marked (literal) in their title in Chapter A8 Instruction Descriptions are PC-relative loads.
Immediate The offset is an unsigned number that can be added to or subtracted from the base register
value. Immediate offset addressing is useful for accessing data elements that are a fixed
distance from the start of the data object, such as structure fields, stack offsets, and
input/output registers.
Register The offset is a value from an ARM core register. This register cannot be the PC. The value
can be added to, or subtracted from, the base register value. Register offsets are useful for
accessing arrays or blocks of data.
Scaled register The offset is an ARM core register, other than the PC, shifted by an immediate value, then
added to or subtracted from the base register. This means an array index can be scaled by
the size of each array element.
The offset and base register can be used in three different ways to form the memory address. The addressing modes
are described as follows:
Offset The offset is added to or subtracted from the base register to form the memory address.
Pre-indexed The offset is added to or subtracted from the base register to form the memory address. The
base register is then updated with this new address, to permit automatic indexing through an
array or memory block.
Post-indexed The value of the base register alone is used as the memory address. The offset is then added
to or subtracted from the base register. The result is stored back in the base register, to permit
automatic indexing through an array or memory block.
Note
Not every variant is available for every instruction, and the range of permitted immediate values and the options for
scaled registers vary from instruction to instruction. See Chapter A8 Instruction Descriptions for full details for
each instruction.
A4-174 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.7 Load/store multiple instructions
Store Multiple instructions store a subset, or possibly all, of the ARM core registers to memory.
The memory locations are consecutive word-aligned words. The addresses used are obtained from a base register,
and can be either above or below the value in the base register. The base register can optionally be updated by the
total size of the data transferred.
Table A4-13 summarizes the load/store multiple instructions in the ARM and Thumb instruction sets.
Instruction See
Load Multiple, Increment After or Full Descending LDM/LDMIA/LDMFD (Thumb) on page A8-397
LDM/LDMIA/LDMFD (ARM) on page A8-399
Pop multiple registers off the stack b POP (Thumb) on page A8-535
POP (ARM) on page A8-537
Store Multiple, Increment After or Empty Ascending STM (STMIA, STMEA) on page A8-665
Store Multiple, Decrement After or Empty Descending a STMDA (STMED) on page A8-667
Store Multiple, Decrement Before or Full Descending STMDB (STMFD) on page A8-669
Store Multiple, Increment Before or Full Ascending a STMIB (STMFA) on page A8-671
When executing at PL1, variants of the LDM and STM instructions load and store User mode registers. Another
system level variant of the LDM instruction performs an exception return. For details of these variants, see Chapter B9
System Instructions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-175
ID040418 Non-Confidential
A4 The Instruction Sets
A4.8 Miscellaneous instructions
Instruction See
ARMv7 defines a YIELD instruction as a specific NOP (No Operation) hint instruction.
The YIELD instruction has no effect in a single-threaded system, but developers of such systems can use the
instruction to flag its intended use on migration to a multiprocessor or multithreading system. Operating systems
can use YIELD in places where a yield hint is wanted, knowing that it will be treated as a NOP if there is no
implementation benefit.
A4-176 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.9 Exception-generating and exception-handling instructions
• The SVC instruction generates a Supervisor Call exception. For more information, see Supervisor Call (SVC)
exception on page B1-1209.
• The Breakpoint instruction BKPT provides software breakpoints. For more information, see About debug
events on page C3-2024.
• In a processor that implements the Security Extensions, when executing at PL1 or higher, the SMC instruction
generates a Secure Monitor Call exception. For more information, see Secure Monitor Call (SMC) exception
on page B1-1210.
• In a processor that implements the Virtualization Extensions, in software executing in a Non-secure PL1
mode, the HVC instruction generates a Hypervisor Call exception. For more information, see Hypervisor Call
(HVC) exception on page B1-1211.
• The system level variants of the SUBS and LDM instructions perform a return from an exception.
Note
The variants of SUBS include MOVS. See the references to SUBS PC, LR in Table A4-15 for more information.
• From ARMv6, the SRS instruction can be used near the start of the handler, to store return information. The
RFE instruction can then perform a return from the exception using the stored return information.
In a processor that implements the Virtualization Extensions, the ERET instruction performs a return from an
exception taken to Hyp mode.
Table A4-15 summarizes the instructions, in the ARM and Thumb instruction sets, for generating or handling an
exception. Except for BKPT and SVC, these are system level instructions.
Instruction See
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-177
ID040418 Non-Confidential
A4 The Instruction Sets
A4.10 Coprocessor instructions
• Initiate a coprocessor data-processing operation. For details see CDP, CDP2 on page A8-356.
• Transfer ARM core registers to and from coprocessor registers. For details, see:
— MCR, MCR2 on page A8-477.
— MCRR, MCRR2 on page A8-479.
— MRC, MRC2 on page A8-493.
— MRRC, MRRC2 on page A8-495.
The instruction set distinguishes up to 16 coprocessors with a 4-bit field in each coprocessor instruction, so each
coprocessor is assigned a particular number.
Note
One coprocessor can use more than one of the 16 numbers if a large coprocessor instruction set is required.
Coprocessors 10 and 11 are used, together, for Floating-point Extension and some Advanced SIMD Extension
functionality. There are different instructions for accessing these coprocessors, of similar types to the instructions
for the other coprocessors, that is, to:
• Initiate a coprocessor data-processing operation. For details see Floating-point data-processing instructions
on page A4-189.
• Transfer ARM core registers to and from coprocessor registers. For details, see Advanced SIMD and
Floating-point register transfer instructions on page A4-181.
• Load or store the values of coprocessor registers. For details, see Advanced SIMD and Floating-point
load/store instructions on page A4-179.
Coprocessors execute the same instruction stream as the processor, ignoring non-coprocessor instructions and
coprocessor instructions for other coprocessors. Coprocessor instructions that cannot be executed by any
coprocessor hardware cause an Undefined Instruction exception.
Coprocessors 8, 9, 12, and 13 are reserved for future use by ARM. Any coprocessor access instruction attempting
to access one of these coprocessors is UNDEFINED.
For more information about specific coprocessors, see Coprocessor support on page A2-93.
A4-178 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.11 Advanced SIMD and Floating-point load/store instructions
Advanced SIMD also provides instructions for loading and storing multiple elements, or structures of elements, see
Element and structure load/store instructions.
Vector Load Multiple VLDM on page A8-923 Load 1-16 consecutive 64-bit registers, Advanced SIMD and Floating-point
Load 1-16 consecutive 32-bit registers, Floating-point only
Vector Load Register VLDR on page A8-925 Load one 64-bit register, Advanced SIMD and Floating-point
Load one 32-bit register, Floating-point only
Vector Store Multiple VSTM on page A8-1081 Store 1-16 consecutive 64-bit registers, Advanced SIMD and Floating-point
Store 1-16 consecutive 32-bit registers, Floating-point only
Vector Store Register VSTR on page A8-1083 Store one 64-bit register, Advanced SIMD and Floating-point
Store one 32-bit register, Floating-point only
Instruction See
To one lane VLD2 (single 2-element structure to one lane) on page A8-907
To all lanes VLD2 (single 2-element structure to all lanes) on page A8-909
To one lane VLD3 (single 3-element structure to one lane) on page A8-913
To all lanes VLD3 (single 3-element structure to all lanes) on page A8-915
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-179
ID040418 Non-Confidential
A4 The Instruction Sets
A4.11 Advanced SIMD and Floating-point load/store instructions
Instruction See
To one lane VLD4 (single 4-element structure to one lane) on page A8-919
To all lanes VLD4 (single 4-element structure to all lanes) on page A8-921
From one lane VST1 (single element from one lane) on page A8-1067
From one lane VST2 (single 2-element structure from one lane) on page A8-1071
From one lane VST3 (single 3-element structure from one lane) on page A8-1075
From one lane VST4 (single 4-element structure from one lane) on page A8-1079
Figure A4-1 shows the de-interleaving of a VLD3.16 (multiple 3-element structures) instruction:
Memory
A[0].x
A[0].y
A[0].z
A[1].x
A is a packed array of A[1].y
3-element structures. A[1].z
Each element is a 16-bit A[2].x
halfword. A[2].y
A[2].z
A[3].x
A[3].y X3 X2 X1 X0 D0
A[3].z Y3 Y2 Y1 Y0 D1 Registers
Z3 Z2 Z1 Z0 D2
Figure A4-1 shows the VLD3.16 instruction operating to three 64-bit registers that comprise four 16-bit elements:
• Different instructions in this group would produce similar figures, but operate on different numbers of
registers. For example, VLD4 and VST4 instructions operate on four registers.
• Different element sizes would produce similar figures but with 8-bit or 32-bit elements.
A4-180 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.12 Advanced SIMD and Floating-point register transfer instructions
Advanced SIMD vectors, and single-precision and double-precision Floating-point registers, are all views of the
same extension register set. For details, see Advanced SIMD and Floating-point Extension registers on page A2-56.
Instruction See
Copy element from ARM core register to every element of Advanced SIMD vector VDUP (ARM core register) on page A8-887
Copy byte, halfword, or word from ARM core register to extension register VMOV (ARM core register to scalar) on
page A8-941
Copy byte, halfword, or word from extension register to ARM core register VMOV (scalar to ARM core register) on
page A8-943
Copy from single-precision Floating-point register to ARM core register, or from VMOV (between ARM core register and
ARM core register to single-precision Floating-point register single-precision register) on page A8-945
Copy two words from ARM core registers to consecutive single-precision VMOV (between two ARM core registers and
Floating-point registers, or from consecutive single-precision Floating-point two single-precision registers) on page A8-947
registers to ARM core registers
Copy two words from ARM core registers to doubleword extension register, or from VMOV (between two ARM core registers and a
doubleword extension register to ARM core registers doubleword extension register) on page A8-949
Copy from Advanced SIMD and Floating-point Extension System Register to ARM VMRS on page A8-955
core register VMRS on page B9-2000 (system level view)
Copy from ARM core register to Advanced SIMD and Floating-point Extension VMSR on page A8-957
System Register VMSR on page B9-2002 (system level view)
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-181
ID040418 Non-Confidential
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Instructions operate on vectors held in 64-bit or 128-bit registers. Figure A4-2 shows an operation on two 64-bit
operand vectors, generating a 64-bit vector result.
Note
Figure A4-2 and other similar figures show 64-bit vectors that consist of four 16-bit elements, and 128-bit vectors
that consist of four 32-bit elements. Other element sizes produce similar figures, but with one, two, eight, or sixteen
operations performed in parallel instead of four.
Dn
Dm
Op Op Op Op
Dd
Many Advanced SIMD instructions have variants that produce vectors of elements double the size of the inputs. In
this case, the number of elements in the result vector is the same as the number of elements in the operand vectors,
but each element, and the whole vector, is double the size.
Figure A4-3 shows an example of an Advanced SIMD instruction operating on 64-bit registers, and generating a
128-bit result.
Dn
Dm
Op Op Op Op
Qd
There are also Advanced SIMD instructions that have variants that produce vectors containing elements half the
size of the inputs. Figure A4-4 on page A4-183 shows an example of an Advanced SIMD instruction operating on
one 128-bit register, and generating a 64-bit result.
A4-182 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Qn
Op Op Op Op
Dd
Some Advanced SIMD instructions do not conform to these standard patterns. Their operation patterns are
described in the individual instruction descriptions.
Advanced SIMD instructions that perform floating-point arithmetic use the ARM standard floating-point arithmetic
defined in Floating-point data types and arithmetic on page A2-62.
Instruction See
Vector Add and Narrow, returning High Half VADDHN on page A8-833
Vector Add Long, Vector Add Wide VADDL, VADDW on page A8-835
Vector Halving Add, Vector Halving Subtract VHADD, VHSUB on page A8-897
Vector Rounding Add and Narrow, returning High Half VRADDHN on page A8-1023
Vector Rounding Subtract and Narrow, returning High Half VRSUBHN on page A8-1045
Vector Subtract and Narrow, returning High Half VSUBHN on page A8-1089
Vector Subtract Long, Vector Subtract Wide VSUBL, VSUBW on page A8-1091
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-183
ID040418 Non-Confidential
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Instruction See
Vector Bitwise Bit Clear (AND complement) VBIC (immediate) on page A8-839
VBIC (register) on page A8-841
Instruction See
Vector Compare Greater Than or Equal to Zero VCGE (immediate #0) on page A8-851
Vector Compare Greater Than Zero VCGT (immediate #0) on page A8-855
Vector Compare Less Than or Equal to Zero VCLE (immediate #0) on page A8-857
Vector Compare Less Than Zero VCLT (immediate #0) on page A8-861
A4-184 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Instruction See
Vector Saturating Rounding Shift Right and Narrow VQRSHRN, VQRSHRUN on page A8-1013
Vector Saturating Shift Right and Narrow VQSHRN, VQSHRUN on page A8-1019
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-185
ID040418 Non-Confidential
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Instruction See
Vector Multiply Accumulate Long VMLA, VMLAL, VMLS, VMLSL (integer) on page A8-931
VMLA, VMLS (floating-point) on page A8-933
Vector Multiply Subtract VMLA, VMLAL, VMLS, VMLSL (by scalar) on page A8-935
Vector Multiply Subtract Long
Vector Saturating Doubling Multiply Returning High Half VQDMULH on page A8-1001
Vector Saturating Rounding Doubling Multiply Returning High Half VQRDMULH on page A8-1009
• 8-bit polynomials over {0, 1}. VMUL and VMULL are the only instructions that operate on polynomials. VMULL
produces a 16-bit polynomial over {0, 1}.
Long instructions have doubleword (64-bit) operands, and produce quadword (128-bit) results. Other Advanced
SIMD multiply instructions can have either doubleword or quadword operands, and produce results of the same
size.
A4-186 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Instruction See
Vector Convert between floating-point and fixed VCVT (between floating-point and fixed-point, Advanced SIMD) on
point page A8-873
Vector Convert between floating-point and integer VCVT (between floating-point and integer, Advanced SIMD) on page A8-869
Vector Convert between half-precision and VCVT (between half-precision and single-precision, Advanced SIMD) on
single-precision page A8-879
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-187
ID040418 Non-Confidential
A4 The Instruction Sets
A4.13 Advanced SIMD data-processing instructions
Instruction See
A4-188 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A4 The Instruction Sets
A4.14 Floating-point data-processing instructions
For details of the floating-point arithmetic used by Floating-point instructions, see Floating-point data types and
arithmetic on page A2-62.
Instruction See
Convert between floating-point and integer VCVT, VCVTR (between floating-point and integer, Floating-point) on
page A8-871
Convert between floating-point and fixed-point VCVT (between floating-point and fixed-point, Floating-point) on
page A8-875
Convert between double-precision and single-precision VCVT (between double-precision and single-precision) on page A8-877
Multiply Subtract
Copy from one extension register to another VMOV (register) on page A8-939
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A4-189
ID040418 Non-Confidential
A4 The Instruction Sets
A4.14 Floating-point data-processing instructions
A4-190 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A5
ARM Instruction Set Encoding
This chapter describes the encoding of the ARM instruction set. It contains the following sections:
• ARM instruction set encoding on page A5-192.
• Data-processing and miscellaneous instructions on page A5-194.
• Load/store word and unsigned byte on page A5-206.
• Media instructions on page A5-207.
• Branch, branch with link, and block data transfer on page A5-212.
• Coprocessor instructions, and Supervisor Call on page A5-213.
• Unconditional instructions on page A5-214.
Note
• Architecture variant information in this chapter describes the architecture variant or extension in which the
instruction encoding was introduced into the ARM instruction set. All means that the instruction encoding
was introduced in ARMv4 or earlier, and so is in all variants of the ARM instruction set covered by this
manual.
• In the decode tables in this chapter, an entry of - for a field value means the value of the field does not affect
the decoding.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-191
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.1 ARM instruction set encoding
Table A5-1 shows the major subdivisions of the ARM instruction set, determined by bits[31:25, 4].
Most ARM instructions can be conditional, with a condition determined by bits[31:28] of the instruction, the cond
field. For more information, see The condition code field. This applies to all instructions except those with the cond
field equal to 0b1111.
10x - Branch, branch with link, and block data transfer on page A5-212.
1111 - - If the cond field is 0b1111, the instruction can only be executed unconditionally, see Unconditional
instructions on page A5-214.
Includes Advanced SIMD instructions, see Chapter A7 Advanced SIMD and Floating-point
Instruction Encoding.
This field contains one of the values 0b0000-0b1110, as shown in Table A8-1 on page A8-286. Most instruction
mnemonics can be extended with the letters defined in the mnemonic extension column of this table.
If the always (AL) condition is specified, the instruction is executed irrespective of the value of the condition flags.
The absence of a condition code on an instruction mnemonic implies the AL condition code.
A5-192 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.1 ARM instruction set encoding
• The pseudocode for that encoding does not indicate that a different special case applies, and a bit marked (0)
or (1) in the encoding diagram of an instruction is not 0 or 1 respectively.
For more information about UNDEFINED and UNPREDICTABLE instruction behavior, see Undefined Instruction
exception on page B1-1205.
• ARM instructions introduced in an architecture variant are UNDEFINED in earlier architecture variants.
• ARM instructions introduced in one or more architecture extensions are UNDEFINED in an implementation
that does not include any of those extensions.
Many instructions are UNPREDICTABLE if they use 0b1111 as a register specifier. This is specified by pseudocode in
the instruction description.
Note
In ARMv7, ARM deprecates use of the PC as the base register in any store instruction.
ARM deprecates using SP for any purpose other than as a stack pointer.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-193
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
10100 - High halfword 16-bit immediate load, MOVT on page A8-492 v6T2
A5-194 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
Table A5-3 shows the allocation of encodings in this space. These encodings are in all architecture variants.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-195
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
Table A5-4 shows the allocation of encodings in this space. These encodings are in all architecture variants.
0111x - Reverse Subtract with Carry RSC (register-shifted register) on page A8-585
A5-196 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
Table A5-5 shows the allocation of encodings in this space. These encodings are in all architecture variants.
op Rn Instruction See
These instructions all have modified immediate constants, rather than a simple 12-bit binary number. This provides
a more useful range of values. For details, see Modified immediate constants in ARM instructions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-197
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
Table A5-6 shows the range of modified immediate constants available in ARM data-processing instructions, and
their encoding in the a, b, c, d, e, f, g, and h bits and the rotation field in the instruction.
rotation <const> a
. .
. . 8-bit values shifted to other even-numbered positions
. .
. .
. . 8-bit values shifted to other even-numbered positions
. .
a. This table shows the immediate constant value in binary form, to relate abcdefgh to the encoding diagram.
In assembly syntax, the immediate value is specified in the usual way (a decimal number by default).
Note
The range of values available in ARM modified immediate constants is slightly different from the range of values
available in 32-bit Thumb instructions. See Modified immediate constants in Thumb instructions on page A6-230.
Carry out
A logical instruction with the rotation field set to 0b0000 does not affect APSR.C. Otherwise, a logical flag-setting
instruction sets APSR.C to the value of bit[31] of the modified immediate constant.
In particular, this means that all constants in the range 0-255 are encoded with rotation == 0b0000, and permitted
constants outside that range are encoded with rotation != 0b0000. A flag-setting logical instruction with a modified
immediate constant therefore leaves APSR.C unchanged if the constant is in the range 0-255 and sets it to the most
significant bit of the constant otherwise. This matches the behavior of Thumb modified immediate constants for all
constants that are permitted in both the ARM and Thumb instruction sets.
An alternative syntax is available for a modified immediate constant that permits the programmer to specify the
encoding directly. In this syntax, #<const> is instead written as #<byte>, #<rot>, where:
A5-198 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
<rot> Is twice the numeric value of rotation, an even number in the range 0-30.
This syntax permits all ARM data-processing instructions with modified immediate constants to be disassembled
to assembler syntax that assembles to the original instruction.
This syntax also makes it possible to write variants of some flag-setting logical instructions that have different
effects on APSR.C to those obtained with the normal #<const> syntax. For example, ANDS R1, R2, #12, #2 has the
same behavior as ANDS R1, R2, #3 except that it sets APSR.C to 0 instead of leaving it unchanged. Such variants of
flag-setting logical instructions do not have equivalents in the Thumb instruction set, and ARM deprecates their use.
// APSR.C argument to following function call does not affect the imm32 result.
(imm32, -) = ARMExpandImm_C(imm12, APSR.C);
return imm32;
// ARMExpandImm_C()
// ================
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-199
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
0101 UNDEFINED - -
0111 UNDEFINED - -
Table A5-8 shows the allocation of encodings in this space. These encodings are all available in ARMv5TE and
above, and are UNDEFINED in earlier variants of the architecture.
op Instruction See
A5-200 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
These encodings are signed multiply (SMUL) and signed multiply accumulate (SMLA) instructions, operating on 16-bit
values, or mixed 16-bit and 32-bit values. The results and accumulators are 32-bit or 64-bit.
These encodings are all available in ARMv5TE and above, and are UNDEFINED in earlier variants of the architecture.
00 - Signed 16-bit multiply, 32-bit accumulate SMLABB, SMLABT, SMLATB, SMLATT on page A8-621
01 0 Signed 16-bit × 32-bit multiply, 32-bit accumulate SMLAWB, SMLAWT on page A8-631
1 Signed 16-bit × 32-bit multiply, 32-bit result SMULWB, SMULWT on page A8-649
10 - Signed 16-bit multiply, 64-bit accumulate SMLALBB, SMLALBT, SMLALTB, SMLALTT on page A8-627
11 - Signed 16-bit multiply, 32-bit result SMULBB, SMULBT, SMULTB, SMULTT on page A8-645
If (op2 == 0b00), then see Data-processing and miscellaneous instructions on page A5-194.
If ((op1 == 0b0xx10) && (op2 == 0b01)) or ((op1 == 0b0xx11) && (op2 != 0b00)) then see Extra load/store
instructions, unprivileged on page A5-202.
xx1x1 not 1111 Load Halfword LDRH (immediate, ARM) on page A8-443 All
xx1x0 not 1111 Load Dual LDRD (immediate) on page A8-427 v5TE
xx1x1 not 1111 Load Signed Byte LDRSB (immediate) on page A8-451 All
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-201
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
xx1x1 not 1111 Load Signed Halfword LDRSH (immediate) on page A8-459 All
If op2 == 0b00 then see Data-processing and miscellaneous instructions on page A5-194.
If (op == 0b0 && op2 == 0b1x) then see Extra load/store instructions on page A5-201.
A5-202 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
0x00 Swap Word, Swap Byte SWP, SWPB on page A8-723 a All
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-203
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
Table A5-13 shows the allocation of encodings in this space. Encodings with op set to 0, op1 set to 0b0000, and a
value of op2 that is not shown in the table, are unallocated hints and behave as if op2 is set to 0b00000000. These
unallocated hint encodings are reserved and software must not use them.
0100 - Move to Special register, Application level MSR (immediate) on page A8-499 All
1x00
xx01 - Move to Special register, System level MSR (immediate) on page B9-1982 All
xx1x
1 - - Move to Special register, System level MSR (immediate) on page B9-1982 All
A5-204 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.2 Data-processing and miscellaneous instructions
Table A5-14 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
000 1 x0 xxxx Move from Banked or Special register MRS (Banked register) on page B9-1978 v7VE
x1 xxxx Move to Banked or Special register MSR (Banked register) on page B9-1980 v7VE
01 xx00 Move to Special register, Application level MSR (register) on page A8-501 All
xx01 Move to Special register, System level MSR (register) on page B9-1984 All
xx1x
11 - Move to Special register, System level MSR (register) on page B9-1984 All
011 - 01 - Branch with Link and Exchange BLX (register) on page A8-348 v5T
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-205
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.3 Load/store word and unsigned byte
These instructions have either A == 0 or B == 0. For instructions with A == 1 and B == 1, see Media instructions
on page A5-207.
Otherwise, Table A5-15 shows the allocation of encodings in this space. These encodings are in all architecture
variants.
0 xx0x0 not 0x010 - - Store Register STR (immediate, ARM) on page A8-675
1 0x010 0 -
0 xx0x1 not 0x011 - not 1111 Load Register (immediate) LDR (immediate, ARM) on page A8-409
1 xx0x1 not 0x011 0 - Load Register LDR (register, ARM) on page A8-415
1 0x011 0 -
0 xx1x0 not 0x110 - - Store Register Byte (immediate) STRB (immediate, ARM) on page A8-681
1 xx1x0 not 0x110 0 - Store Register Byte (register) STRB (register) on page A8-683
1 0x110 0 -
0 xx1x1 not 0x111 - not 1111 Load Register Byte (immediate) LDRB (immediate, ARM) on page A8-419
1 xx1x1 not 0x111 0 - Load Register Byte (register) LDRB (register) on page A8-423
1 0x111 0 -
A5-206 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.4 Media instructions
11000 000 1111 - - Unsigned Sum of Absolute Differences USAD8 on page A8-793 v6
1101x x10 - - - Signed Bit Field Extract SBFX on page A8-599 v6T2
1110x x00 - 1111 - Bit Field Clear BFC on page A8-334 v6T2
1111x x10 - - - Unsigned Bit Field Extract UBFX on page A8-757 v6T2
not -a All
1110
a. Issue C.a of this manual first defines an assembler mnemonic for this encoding. This mnemonic applies only to the unconditional encoding,
with cond set to 0b1110.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-207
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.4 Media instructions
Table A5-17 shows the allocation of encodings in this space. These encodings are all available in ARMv6 and
above, and are UNDEFINED in earlier variants of the architecture.
Other encodings in this space are UNDEFINED.
001 Add and Subtract with Exchange, 16-bit SASX on page A8-591
010 Subtract and Add with Exchange, 16-bit SSAX on page A8-657
Saturating instructions
001 Saturating Add and Subtract with Exchange, 16-bit QASX on page A8-547
010 Saturating Subtract and Add with Exchange, 16-bit QSAX on page A8-553
Halving instructions
001 Halving Add and Subtract with Exchange, 16-bit SHASX on page A8-613
010 Halving Subtract and Add with Exchange, 16-bit SHSAX on page A8-615
A5-208 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.4 Media instructions
Table A5-18 shows the allocation of encodings in this space. These encodings are all available in ARMv6 and
above, and are UNDEFINED in earlier variants of the architecture.
001 Add and Subtract with Exchange, 16-bit UASX on page A8-755
010 Subtract and Add with Exchange, 16-bit USAX on page A8-801
Saturating instructions
001 Saturating Add and Subtract with Exchange, 16-bit UQASX on page A8-785
010 Saturating Subtract and Add with Exchange, 16-bit UQSAX on page A8-787
Halving instructions
001 Halving Add and Subtract with Exchange, 16-bit UHASX on page A8-767
010 Halving Subtract and Add with Exchange, 16-bit UHSAX on page A8-769
Table A5-19 on page A5-210 shows the allocation of encodings in this space.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-209
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.4 Media instructions
011 not 1111 Signed Extend and Add Byte 16-bit SXTAB16 on page A8-727 v6
011 not 1111 Signed Extend and Add Byte SXTAB on page A8-725 v6
011 not 1111 Signed Extend and Add Halfword SXTAH on page A8-729 v6
100 011 not 1111 Unsigned Extend and Add Byte 16-bit UXTAB16 on page A8-809 v6
011 not 1111 Unsigned Extend and Add Byte UXTAB on page A8-807 v6
011 not 1111 Unsigned Extend and Add Halfword UXTAH on page A8-811 v6
A5-210 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.4 Media instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 op1 A op2 1
000 00x not 1111 Signed Multiply Accumulate Dual SMLAD on page A8-623 v6
01x not 1111 Signed Multiply Subtract Dual SMLSD on page A8-633 v6
100 00x - Signed Multiply Accumulate Long Dual SMLALD on page A8-629 v6
101 00x not 1111 Signed Most Significant Word Multiply Accumulate SMMLA on page A8-637 v6
11x - Signed Most Significant Word Multiply Subtract SMMLS on page A8-639 v6
a. Optional in some ARMv7 implementations, see ARMv7 implementation requirements and options for the divide instructions on
page A4-170.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-211
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.5 Branch, branch with link, and block data transfer
Table A5-21 shows the allocation of encodings in this space. These encodings are in all architecture variants.
Table A5-21 Branch, branch with link, and block data transfer instructions
op R Rn Instructions See
0010x0 - - Store Multiple Increment After STM (STMIA, STMEA) on page A8-665
001011 - not 1101 Load Multiple Increment After LDM/LDMIA/LDMFD (ARM) on page A8-399
010010 - not 1101 Store Multiple Decrement Before STMDB (STMFD) on page A8-669
0xx1x0 - - Store Multiple (user registers) STM (User registers) on page B9-1994
0xx1x1 0 - Load Multiple (user registers) LDM (User registers) on page B9-1974
A5-212 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.6 Coprocessor instructions, and Supervisor Call
- 00000x - - UNDEFINED - -
0xxxx1 - not 1111 Load Coprocessor (immediate) LDC, LDC2 (immediate) on page A8-393 All
not 000x01
1111 Load Coprocessor (literal) LDC, LDC2 (literal) on page A8-395 All
000100 - - Move to Coprocessor from two MCRR, MCRR2 on page A8-479 v5TE
ARM core registers
000101 - - Move to two ARM core MRRC, MRRC2 on page A8-495 v5TE
registers from Coprocessor
10xxx1 1 - Move to ARM core register MRC, MRC2 on page A8-493 All
from Coprocessor
00010x - - Advanced SIMD, 64-bit transfers between ARM core and extension
Floating-point registers on page A7-277
10xxxx 1 - Advanced SIMD, 8, 16, and 32-bit transfer between ARM core and
Floating-point extension registers on page A7-276
For more information about specific coprocessors see Coprocessor support on page A2-93.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-213
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.7 Unconditional instructions
101xxxxx - - Branch with Link and Exchange BL, BLX (immediate) on page A8-346 v5
110xxxx1 - not 1111 Load Coprocessor (immediate) LDC, LDC2 (immediate) on page A8-393 v5
not 11000x01
1111 Load Coprocessor (literal) LDC, LDC2 (literal) on page A8-395 v5
11000100 - - Move to Coprocessor from two ARM MCRR, MCRR2 on page A8-479 v6
core registers
11000101 - - Move to two ARM core registers MRRC, MRRC2 on page A8-495 v6
from Coprocessor
1110xxx1 1 - Move to ARM core register from MRC, MRC2 on page A8-493 v5
Coprocessor
A5-214 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A5 ARM Instruction Set Encoding
A5.7 Unconditional instructions
Other encodings in this space are UNDEFINED in ARMv5 and above. All these encodings are UNPREDICTABLE in
ARMv4 and ARMv4T.
0010000 xx0x xxx0 Change Processor State CPS (ARM) on page B9-1966 v6
100xxx0 - - See Advanced SIMD element or structure load/store instructions on page A7-273 v7
100xx11 - - UNPREDICTABLE - -
101x001 - not 1111 Preload Data with intent to Write PLD, PLDW (immediate) on page A8-525 MP Ext a
1111 UNPREDICTABLE - -
101x101 - not 1111 Preload Data PLD, PLDW (immediate) on page A8-525 v5TE
1010011 - - UNPREDICTABLE - -
001x - UNPREDICTABLE - -
0111 - UNPREDICTABLE - -
1xxx - UNPREDICTABLE - -
1011x11 - - UNPREDICTABLE -
111x001 xxx0 - Preload Data with intent to Write PLD, PLDW (register) on page A8-529 MP Ext a
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A5-215
ID040418 Non-Confidential
A5 ARM Instruction Set Encoding
A5.7 Unconditional instructions
111x101 xxx0 - Preload Data PLD, PLDW (register) on page A8-529 v5TE
a. Multiprocessing Extensions.
b. See Table A5-16 on page A5-207 for the full range of encodings in this permanently UNDEFINED group.
A5-216 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A6
Thumb Instruction Set Encoding
This chapter introduces the Thumb instruction set and describes how it uses the ARM programmers’ model. It
contains the following sections:
• Thumb instruction set encoding on page A6-218.
• 16-bit Thumb instruction encoding on page A6-221.
• 32-bit Thumb instruction encoding on page A6-228.
For details of the differences between the Thumb and ThumbEE instruction sets, see Chapter A9 The ThumbEE
Instruction Set.
Note
• Architecture variant information in this chapter describes the architecture variant or extension in which the
instruction encoding was introduced into the Thumb instruction set.
• In the decode tables in this chapter, an entry of - for a field value means the value of the field does not affect
the decoding.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-217
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.1 Thumb instruction set encoding
If the value of bits[15:11] of the halfword being decoded is one of the following, the halfword is the first halfword
of a 32-bit instruction:
• 0b11101.
• 0b11110.
• 0b11111.
For details of the encoding of 16-bit Thumb instructions, see 16-bit Thumb instruction encoding on page A6-221.
For details of the encoding of 32-bit Thumb instructions, see 32-bit Thumb instruction encoding on page A6-228.
• Thumb instructions introduced in an architecture variant are either UNPREDICTABLE or UNDEFINED in earlier
architecture variants.
• A Thumb instruction that is provided by one or more of the architecture extensions is either UNPREDICTABLE
or UNDEFINED in an implementation that does not include any of those extensions.
In both cases, the instruction is UNPREDICTABLE if it is a 32-bit instruction in an architecture variant before
ARMv6T2, and UNDEFINED otherwise.
• Read the PC value, that is, the address of the current instruction + 4. The base register of the table branch
instructions TBB and TBH can be the PC. This means branch tables can be placed in memory immediately after
the instruction.
• Read the word-aligned PC value, that is, the address of the current instruction + 4, with bits[1:0] forced to
zero. The base register of LDC, LDR, LDRB, LDRD (pre-indexed, no writeback), LDRH, LDRSB, and LDRSH instructions
can be the word-aligned PC. This provides PC-relative data addressing. In addition, some encodings of the
ADD and SUB instructions permit their source registers to be 0b1111 for the same purpose.
A6-218 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.1 Thumb instruction set encoding
• Read zero. This is done in some cases when one instruction is a special case of another, more general
instruction, but with one operand zero. In these cases, the instructions are listed on separate pages, with a
special case in the pseudocode for the more general instruction cross-referencing the other page.
• The PC can be specified as the destination register of an LDR instruction. This is done by encoding Rt as
0b1111. The loaded value is treated as an address, and the effect of execution is a branch to that address. Bit[0]
of the loaded value selects whether to execute ARM or Thumb instructions after the branch.
• Some other instructions write the PC in similar ways. An instruction can specify that the PC is written:
— Implicitly, for example, branch instructions.
— Explicitly by a register specifier of 0b1111, for example 16-bit MOV (register) instructions.
— Explicitly by using a register mask, for example LDM instructions.
The address to branch to can be:
— A loaded value, for example, RFE.
— A register value, for example, BX.
— The result of a calculation, for example, TBB or TBH.
The method of choosing the instruction set used after the branch can be:
— Similar to the LDR case, for example, LDM or BX.
— A fixed instruction set other than the one currently being used, for example, the immediate form of BLX.
— Unchanged, for example, branch instructions or 16-bit MOV (register) instructions.
— Set from the {J, T} bits of the SPSR, for RFE and SUBS PC, LR, #imm8.
• Discard the result of a calculation. This is done in some cases when one instruction is a special case of
another, more general instruction, but with the result discarded. In these cases, the instructions are listed on
separate pages, with a special case in the pseudocode for the more general instruction cross-referencing the
other page.
• If the destination register specifier of an LDRB, LDRH, LDRSB, or LDRSH instruction is 0b1111, the instruction is a
memory hint instead of a load operation.
• If the destination register specifier of an MRC instruction is 0b1111, bits[31:28] of the value transferred from
the coprocessor are written to the N, Z, C, and V condition flags in the APSR, and bits[27:0] are discarded.
See also 16-bit Thumb instruction support for R13 on page A6-220.
R13[1:0] definition
Bits[1:0] of R13 are SBZP. Writing a nonzero value to bits[1:0] causes UNPREDICTABLE behavior.
• R13 as the source or destination register of a MOV instruction. Only register to register transfers without shifts
are supported, with no flag-setting:
MOV SP, <Rm>
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-219
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.1 Thumb instruction set encoding
MOV <Rn>, SP
• R13 as a base register <Rn> of any load/store instruction. This supports SP-based addressing for load, store,
or memory hint instructions, with positive or negative offsets, with and without writeback.
• R13 as the first operand <Rn> in any ADD{S}, CMN, CMP, or SUB{S} instruction. The add and subtract instructions
support SP-based address generation, with the address going into an ARM core register, R0-R12, or R14. CMN
and CMP are useful for stack checking in some circumstances.
A6-220 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
00xxxx Shift (immediate), add, subtract, move, and compare on page A6-222 -
010001 Special data instructions and branch and exchange on page A6-224 -
01001x Load from Literal Pool, see LDR (literal) on page A8-411 v4T
10101x Generate SP-relative address, see ADD (SP plus immediate) on page A8-314 v4T
11000x Store multiple registers, see STM (STMIA, STMEA) on page A8-665 a v4T
11001x Load multiple registers, see LDM/LDMIA/LDMFD (Thumb) on page A8-397 a v4T
a. In ThumbEE, 16-bit load/store multiple instructions are not available. This encoding is used for special
ThumbEE instructions. For details, see Chapter A9 The ThumbEE Instruction Set.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-221
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
All these instructions are available since the Thumb instruction set was introduced in ARMv4T.
Table A6-2 16-bit Thumb shift (immediate), add, subtract, move, and compare instructions
a. When Opcode is 0b00000, and bits[8:6] are 0b000, this is an encoding for MOV, see
MOV (register, Thumb) on page A8-487.
A6-222 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
A6.2.2 Data-processing
The encoding of 16-bit Thumb data-processing instructions is:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 Opcode
All these instructions are available since the Thumb instruction set was introduced in ARMv4T.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-223
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 Opcode
Table A6-4 16-bit Thumb special data instructions and branch and exchange
0000 Add Low Registers ADD (register, Thumb) on page A8-308 v6T2 a
0001 Add High Registers ADD (register, Thumb) on page A8-308 v4T
001x
1001 Move High Registers MOV (register, Thumb) on page A8-487 v4T
101x
111x Branch with Link and Exchange BLX (register) on page A8-348 v5T a
a. UNPREDICTABLE in earlier variants.
A6-224 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
opA opB
All these instructions are available since the Thumb instruction set was introduced in ARMv4T.
0111 0xx Store Register Byte STRB (immediate, Thumb) on page A8-679
1000 0xx Store Register Halfword STRH (immediate, Thumb) on page A8-699
1001 0xx Store Register SP relative STR (immediate, Thumb) on page A8-673
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-225
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 Opcode
Table A6-6 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
00000xx Add Immediate to SP ADD (SP plus immediate) on page A8-314 v4T
00001xx Subtract Immediate from SP SUB (SP minus immediate) on page A8-717 v4T
0001xxx Compare and Branch on Zero CBNZ, CBZ on page A8-354 v6T2
0011xxx Compare and Branch on Zero CBNZ, CBZ on page A8-354 v6T2
1001xxx Compare and Branch on Nonzero CBNZ, CBZ on page A8-354 v6T2
1011xxx Compare and Branch on Nonzero CBNZ, CBZ on page A8-354 v6T2
A6-226 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.2 16-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 opA opB
Other encodings in this space are unallocated hints. They execute as NOPs, but software must not use them.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 1 Opcode
All these instructions are available since the Thumb instruction set was introduced in ARMv4T.
a. Issue C.a of this manual first defines an assembler mnemonic for this encoding.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-227
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
If op1 == 0b00, a 16-bit instruction is encoded, see 16-bit Thumb instruction encoding on page A6-221.
Otherwise, Table A6-9 shows the allocation of encodings in this space.
00xx111 - UNDEFINED
0111xxx - Long multiply, long multiply accumulate, and divide on page A6-248
A6-228 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-10 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
These encodings are all available in ARMv6T2 and above.
These instructions all have modified immediate constants, rather than a simple 12-bit binary number. This provides
a more useful range of values. For details, see Modified immediate constants in Thumb instructions on page A6-230.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-229
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
i imm3 a b c d e f g h
Table A6-11 shows the range of modified immediate constants available in Thumb data-processing instructions, and
their encoding in the a, b, c, d, e, f, g, h, and i bits, and the imm3 field, in the instruction.
i:imm3:a <const> a
. .
. . 8-bit values shifted to other positions
. .
a. This table shows the immediate constant value in binary form, to relate abcdefgh to the encoding diagram.
In assembly syntax, the immediate value is specified in the usual way (a decimal number by default).
b. Not available in ARM instructions. UNPREDICTABLE if abcdefgh == 00000000.
c. Not available in ARM instructions if h == 1.
Note
As the footnotes to Table A6-11 show, the range of values available in Thumb modified immediate constants is
slightly different from the range of values available in ARM instructions. See Modified immediate constants in ARM
instructions on page A5-197 for the ARM values.
Carry out
A logical instruction with i:imm3:a == '00xxx' does not affect the Carry flag. Otherwise, a logical flag-setting
instruction sets the Carry flag to the value of bit[31] of the modified immediate constant.
A6-230 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
// APSR.C argument to following function call does not affect the imm32 result.
(imm32, -) = ThumbExpandImm_C(imm12, APSR.C);
return imm32;
// ThumbExpandImm_C()
// ==================
case imm12<9:8> of
when '00'
imm32 = ZeroExtend(imm12<7:0>, 32);
when '01'
if imm12<7:0> == '00000000' then UNPREDICTABLE;
imm32 = '00000000' : imm12<7:0> : '00000000' : imm12<7:0>;
when '10'
if imm12<7:0> == '00000000' then UNPREDICTABLE;
imm32 = imm12<7:0> : '00000000' : imm12<7:0> : '00000000';
when '11'
if imm12<7:0> == '00000000' then UNPREDICTABLE;
imm32 = imm12<7:0> : imm12<7:0> : imm12<7:0> : imm12<7:0>;
carry_out = carry_in;
else
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-231
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 op Rn 0
Table A6-12 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
These encodings are all available in ARMv6T2 and above.
op Rn Instruction See
00000 not 1111 Add Wide (12-bit) ADD (immediate, Thumb) on page A8-304
01010 not 1111 Subtract Wide (12-bit) SUB (immediate, Thumb) on page A8-709
A6-232 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-13 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
xx1xxxxx 011100x - Move to Banked or Special register MSR (Banked register) on v7VE
page B9-1980
xx0xxxxx 0111000 xx00 Move to Special register, Application MSR (register) on page A8-501 All
level
xx1xxxxx 011111x - Move from Banked or Special MRS (Banked register) on v7VE
register page B9-1978
xx0xxxxx 0111110 - Move from Special register, MRS on page A8-497 v6T2
Application level
0111111 - Move from Special register, System MRS on page B9-1976 v6T2
level
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-233
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
1x0 - - - Branch with Link and Exchange BL, BLX (immediate) on v5T c
page A8-346
a. v7VE, that is, ARMv7 with the Virtualization Extensions, first defines ERET as an assembler mnemonic for this encoding. From ARMv6T2
this is an encoding for SUBS PC, LR (Thumb) on page B9-1996 with an imm8 value of zero. The Virtualization Extensions do not change
the behavior of the encoded instruction when it is executed at PL1.
b. Issue C.a of this manual first defines an assembler mnemonic for this encoding.
c. UNDEFINED in ARMv4T.
Table A6-14 shows the allocation of encodings in this space. Encodings with op1 set to 0b000 and a value of op2 that
is not shown in the table are unallocated hints, and behave as if op2 is set to 0b00000000. These unallocated hint
encodings are reserved and software must not use them.
not 000 - Change Processor State CPS (Thumb) on page B9-1964 v6T2
A6-234 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-15 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED in
ARMv7. They are UNPREDICTABLE in ARMv6T2.
01 0 - Store Multiple (Increment After, Empty Ascending) STM (STMIA, STMEA) on page A8-665
1 not 11101 Load Multiple (Increment After, Full Descending) LDM/LDMIA/LDMFD (Thumb) on page A8-397
11101 Pop Multiple Registers from the stack POP (Thumb) on page A8-535
10 0 not 11101 Store Multiple (Decrement Before, Full Descending) STMDB (STMFD) on page A8-669
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-235
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-17 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
1x x0 - -
0x 11 - not 1111 Load Register Dual (immediate) LDRD (immediate) on page A8-427 v6T2
1x x1 - not 1111
0x 11 - 1111 Load Register Dual (literal) LDRD (literal) on page A8-429 v6T2
1x x1 - 1111
A6-236 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-18 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
These encodings are all available in ARMv6T2 and above.
00 000000 not 1111 Load Register LDR (register, Thumb) on page A8-413
00 1xx1xx not 1111 Load Register LDR (immediate, Thumb) on page A8-407
01 - not 1111
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-237
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-19 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
Except where otherwise noted, these encodings are available in ARMv6T2 and above.
0x - 1111 not 1111 Load Register Halfword LDRH (literal) on page A8-445
00 000000 not 1111 not 1111 Load Register Halfword LDRH (register) on page A8-447
1110xx not 1111 - Load Register Halfword Unprivileged LDRHT on page A8-449
000000 not 1111 1111 Preload Data with intent to Write a PLD, PLDW (register) on page A8-529
1100xx not 1111 1111 Preload Data with intent to Write a PLD, PLDW (immediate) on
page A8-525
01 - not 1111 1111
10 1xx1xx not 1111 - Load Register Signed Halfword LDRSH (immediate) on page A8-459
1x - 1111 not 1111 Load Register Signed Halfword LDRSH (literal) on page A8-461
10 000000 not 1111 not 1111 Load Register Signed Halfword LDRSH (register) on page A8-463
1110xx not 1111 - Load Register Signed Halfword Unprivileged LDRSHT on page A8-465
1x - 1111 1111
a. Available in ARMv7 with the Multiprocessing Extensions. In an ARMv7 implementation that does not include the Multiprocessing
Extensions, and in ARMv6T2, these are unallocated memory hints, that are treated as NOPs.
A6-238 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 op1 0 0 1 Rn Rt op2
Table A6-20 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
These encodings are all available in ARMv6T2 and above.
00 000000 not 1111 not 1111 Load Register Byte LDRB (register) on page A8-423
0x - 1111 not 1111 Load Register Byte LDRB (literal) on page A8-421
00 1xx1xx not 1111 - Load Register Byte LDRB (immediate, Thumb) on page A8-417
1110xx not 1111 - Load Register Byte Unprivileged LDRBT on page A8-425
01 - not 1111 not 1111 Load Register Byte LDRB (immediate, Thumb) on page A8-417
10 000000 not 1111 not 1111 Load Register Signed Byte LDRSB (register) on page A8-455
1x - 1111 not 1111 Load Register Signed Byte LDRSB (literal) on page A8-453
10 1xx1xx not 1111 - Load Register Signed Byte LDRSB (immediate) on page A8-451
1100xx not 1111 not 1111 Load Register Signed Byte LDRSB (immediate) on page A8-451
1110xx not 1111 - Load Register Signed Byte Unprivileged LDRSBT on page A8-457
11 - not 1111 not 1111 Load Register Signed Byte LDRSB (immediate) on page A8-451
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-239
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-21 show the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
These encodings are all available in ARMv6T2 and above.
000 1xx1xx Store Register Byte STRB (immediate, Thumb) on page A8-679
1100xx
100 -
001 1xx1xx Store Register Halfword STRH (immediate, Thumb) on page A8-699
1100xx
101 -
1100xx
110 -
A6-240 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 op S Rn Rd
Table A6-22 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
These encodings are all available in ARMv6T2 and above.
Table A6-23 on page A6-242 shows the allocation of encodings in this space.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-241
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
A6-242 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
If, in the second halfword of the instruction, bits[15:12] != 0b1111, the instruction is UNDEFINED.
Table A6-24 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
0000 1xxx not 1111 Signed Extend and Add Halfword SXTAH on page A8-729
0001 1xxx not 1111 Unsigned Extend and Add Halfword UXTAH on page A8-811
0010 1xxx not 1111 Signed Extend and Add Byte 16-bit SXTAB16 on page A8-727
0011 1xxx not 1111 Unsigned Extend and Add Byte 16-bit UXTAB16 on page A8-809
0100 1xxx not 1111 Signed Extend and Add Byte SXTAB on page A8-725
0101 1xxx not 1111 Unsigned Extend and Add Byte UXTAB on page A8-807
If, in the second halfword of the instruction, bits[15:12] != 0b1111, the instruction is UNDEFINED.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-243
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-25 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED. These
encodings are all available in ARMv6T2 and above.
010 00 Add and Subtract with Exchange, 16-bit SASX on page A8-591
110 00 Subtract and Add with Exchange, 16-bit SSAX on page A8-657
Saturating instructions
010 01 Saturating Add and Subtract with Exchange, 16-bit QASX on page A8-547
110 01 Saturating Subtract and Add with Exchange, 16-bit QSAX on page A8-553
Halving instructions
010 10 Halving Add and Subtract with Exchange, 16-bit SHASX on page A8-613
110 10 Halving Subtract and Add with Exchange, 16-bit SHSAX on page A8-615
If, in the second halfword of the instruction, bits[15:12] != 0b1111, the instruction is UNDEFINED.
A6-244 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-26 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED. These
encodings are all available in ARMv6T2 and above.
010 00 Add and Subtract with Exchange, 16-bit UASX on page A8-755
110 00 Subtract and Add with Exchange, 16-bit USAX on page A8-801
Saturating instructions
010 01 Saturating Add and Subtract with Exchange, 16-bit UQASX on page A8-785
110 01 Saturating Subtract and Add with Exchange, 16-bit UQSAX on page A8-787
Halving instructions
010 10 Halving Add and Subtract with Exchange, 16-bit UHASX on page A8-767
110 10 Halving Subtract and Add with Exchange, 16-bit UHSAX on page A8-769
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-245
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
If, in the second halfword of the instruction, bits[15:12] != 0b1111, the instruction is UNDEFINED.
Table A6-27 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED. These
encodings are all available in ARMv6T2 and above.
A6-246 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 op1 Ra 0 0 op2
If, in the second halfword of the instruction, bits[7:6] != 0b00, the instruction is UNDEFINED.
Table A6-28 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED. These
encodings are all available in ARMv6T2 and above.
001 - not 1111 Signed Multiply Accumulate (Halfwords) SMLABB, SMLABT, SMLATB, SMLATT on
page A8-621
010 0x not 1111 Signed Multiply Accumulate Dual SMLAD on page A8-623
011 0x not 1111 Signed Multiply Accumulate (Word by halfword) SMLAWB, SMLAWT on page A8-631
100 0x not 1111 Signed Multiply Subtract Dual SMLSD on page A8-633
101 0x not 1111 Signed Most Significant Word Multiply Accumulate SMMLA on page A8-637
110 0x - Signed Most Significant Word Multiply Subtract SMMLS on page A8-639
111 00 not 1111 Unsigned Sum of Absolute Differences, Accumulate USADA8 on page A8-795
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-247
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 op1 op2
Table A6-29 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
100 0000 Signed Multiply Accumulate Long SMLAL on page A8-625 v6T2
10xx Signed Multiply Accumulate Long (Halfwords) SMLALBB, SMLALBT, SMLALTB, SMLALTT on v6T2
page A8-627
110x Signed Multiply Accumulate Long Dual SMLALD on page A8-629 v6T2
101 110x Signed Multiply Subtract Long Dual SMLSLD on page A8-635 v6T2
110 0000 Unsigned Multiply Accumulate Long UMLAL on page A8-777 v6T2
0110 Unsigned Multiply Accumulate Accumulate Long UMAAL on page A8-775 v6T2
a. Optional in some ARMv7 implementations, see ARMv7 implementation requirements and options for the divide instructions on
page A4-170.
A6-248 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
Table A6-30 shows the allocation of encodings in this space. These encodings are all available in ARMv6T2 and
above:
- 00000x - - UNDEFINED -
0xxxx1 - not 1111 Load Coprocessor (immediate) LDC, LDC2 (immediate) on page A8-393
not 000x0x
1111 Load Coprocessor (literal) LDC, LDC2 (literal) on page A8-395
00010x - - Advanced SIMD, 64-bit transfers between ARM core and extension
Floating-point registers on page A7-277
10xxxx 1 - Advanced SIMD, 8, 16, and 32-bit transfer between ARM core and
Floating-point extension registers on page A7-276
For more information about specific coprocessors see Coprocessor support on page A2-93.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A6-249
ID040418 Non-Confidential
A6 Thumb Instruction Set Encoding
A6.3 32-bit Thumb instruction encoding
A6-250 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A7
Advanced SIMD and Floating-point
Instruction Encoding
This chapter gives an overview of the Advanced SIMD and Floating-point (VFP) instruction sets. It contains the
following sections:
• Overview on page A7-252.
• Advanced SIMD and Floating-point instruction syntax on page A7-253.
• Register encoding on page A7-257.
• Advanced SIMD data-processing instructions on page A7-259.
• Floating-point data-processing instructions on page A7-270.
• Extension register load/store instructions on page A7-272.
• Advanced SIMD element or structure load/store instructions on page A7-273.
• 8, 16, and 32-bit transfer between ARM core and extension registers on page A7-276.
• 64-bit transfers between ARM core and extension registers on page A7-277.
Note
• The Advanced SIMD architecture extension, its associated implementations, and supporting software, are
commonly referred to as NEON™ technology.
• In the decode tables in this chapter, an entry of - for a field value means the value of the field does not affect
the decoding.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-251
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.1 Overview
A7.1 Overview
All Advanced SIMD and Floating-point instructions are available in both ARM state and Thumb state.
A7.1.2 Floating-point
The following sections describe the classes of instruction in the Floating-point Extension:
• Extension register load/store instructions on page A7-272.
• 8, 16, and 32-bit transfer between ARM core and extension registers on page A7-276.
• 64-bit transfers between ARM core and extension registers on page A7-277.
• Floating-point data-processing instructions on page A7-270.
A7-252 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.2 Advanced SIMD and Floating-point instruction syntax
Advanced SIMD and Floating-point data-processing instructions use the following general format:
All Advanced SIMD and Floating-point instructions begin with a V. This distinguishes Advanced SIMD vector and
Floating-point instructions from ARM scalar instructions.
The main operation is specified in the <operation> field. It is usually a three letter mnemonic the same as or similar
to the corresponding scalar integer instruction.
The <c> and <q> fields are standard assembler syntax fields. For details, see Standard assembler syntax fields on
page A8-285.
<modifier> Meaning
(none) The operands and result are all the same width. Dd, Dn, Dm Qd, Qn, Qm
L Long operation - result is twice the width of both operands Qd, Dn, Dm
N Narrow operation - result is half the width of both operands Dd, Qn, Qm
W Wide operation - result and first operand are twice the width of the second operand Qd, Qn, Dm
Note
• Some assemblers support a Q shape specifier, that requires all operands to be Q registers. An example of
using this specifier is VADDQ.S32 q0, q1, q2. This is not standard UAL, and ARM recommends that
programmers do not use a Q shape specifier.
• A disassembler must not generate any shape specifier not shown in Table A7-2.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-253
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.2 Advanced SIMD and Floating-point instruction syntax
The data types of the other operand and result are implied by the <dt> field combined with the instruction shape. For
information about data type formats see Data types supported by the Advanced SIMD Extension on page A2-59.
In the instruction syntax descriptions in Chapter A8 Instruction Descriptions, the <dt> field is usually specified as
a single field. However, where more convenient, it is sometimes specified as a concatenation of two fields,
<type><size>.
Syntax flexibility
There is some flexibility in the data type specifier syntax:
• Software can specify three data types, specifying the result and both operand data types. For example:
VSUBW.I16.I16.S8 Q3, Q5, D0 instead of VSUBW.S8 Q3, Q5, D0
• Software can specify two data types, specifying the data types of the two operands. The data type of the result
is implied by the instruction shape. For example:
VSUBW.I16.S8 Q3, Q5, D0 instead of VSUBW.S8 Q3, Q5, D0
• Software can specify two data types, specifying the data types of the single operand and the result. For
example:
VMOVN.I16.I32 D0, Q1 instead of VMOVN.I32 D0, Q1
• Where an instruction requires a less specific data type, software can instead specify a more specific type, as
shown in Table A7-3.
• Where an instruction does not require a data type, software can provide one.
In all cases, if software provides additional information, the additional information must match the instruction
shape. Disassembly does not regenerate this additional information.
None Any
A7-254 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.2 Advanced SIMD and Floating-point instruction syntax
<Qd> A quadword destination register for the result vector. Advanced SIMD
<Qn> A quadword source register for the first operand vector. Advanced SIMD
<Qm> A quadword source register for the second operand vector. Advanced SIMD
<Dn> A doubleword source register for the first operand vector. Both
<Dm> A doubleword source register for the second operand vector. Both
<Sn> A singleword source register for the first operand vector. Floating-point
<Sm> A singleword source register for the second operand vector. Floating-point
<Dd[x]> A destination scalar for the result. Element x of vector <Dd>. Advanced SIMD
<Dn[x]> A source scalar for the first operand. Element x of vector <Dn>. Both b
<Dm[x]> A source scalar for the second operand. Element x of vector <Dm>. Advanced SIMD
<Rt> An ARM core register, used for a source or destination address. Both
<Rt2> An ARM core register, used for a source or destination address. Both
<Rn> An ARM core register, used as a load or store base address. Both
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-255
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.2 Advanced SIMD and Floating-point instruction syntax
Note
Register lists must not wrap around the end of the register bank.
Syntax flexibility
There is some flexibility in the register list syntax:
• Where a register list contains consecutive registers, they can be specified as a range, instead of listing every
register, for example {D0-D3} instead of {D0, D1, D2, D3}.
• Where a register list contains an even number of consecutive doubleword registers starting with an
even-numbered register, it can be written as a list of quadword registers instead, for example {Q1, Q2} instead
of {D2-D5}.
• Where a register list contains only one register, the enclosing braces can be omitted, for example
VLD1.8 D0, [R0] instead of VLD1.8 {D0}, [R0].
{<Dd>} {D3} D3
A7-256 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.3 Register encoding
Some instructions have options for either doubleword or quadword registers. This is normally encoded in Q, bit[6],
as Q = 0 for doubleword operations, or Q = 1 for quadword operations.
This is encoded in the sz field, bit[8], as sz = 1 for double-precision operations, or sz = 0 for single-precision
operations.
Some instructions use only one or two registers, and use the unused register fields as additional opcode bits.
a. Bit numbers given for the ARM instruction encoding. See the figures in this section for the equivalent bits in the Thumb
encoding.
b. If this bit is 1, the instruction is UNDEFINED.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-257
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.3 Register encoding
Table A7-7 shows the form of encoding for scalars used in multiply instructions. These instructions cannot access
scalars in some registers. The descriptions of the individual instructions contain cross references to this section
where appropriate.
32-bit Advanced SIMD scalars, when used as single-precision floating-point numbers, are equivalent to
Floating-point single-precision registers. That is, Dm[x] in a 32-bit context (0 <= m <= 15, 0 <= x <=1) is equivalent
to S[2m + x].
A7-258 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
Table A7-8 shows the encoding for Advanced SIMD data-processing instructions. Other encodings in this space are
UNDEFINED.
In these instructions, the U bit is in a different location in ARM and Thumb instructions. This is bit[12] of the first
halfword in the Thumb encoding, and bit[24] in the ARM encoding. Other variable bits are in identical locations in
the two encodings, after adjusting for the fact that the ARM encoding is held in memory as a single word and the
Thumb encoding is held as two consecutive halfwords.
The ARM instructions can only be executed unconditionally. The Thumb instructions can be executed conditionally
by using the IT instruction. For details, see IT on page A8-391.
U A B C See
1x000 - 0xx1 One register and a modified immediate value on page A7-267
1x01x - 0xx1
1x1xx - 0xx1
1xxxx - 1xx1
1x10x - x0x0
1x10x - x1x0
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-259
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
Table A7-9 shows the allocation of encodings in this space. Other encodings in this space are UNDEFINED.
01 Vector Bitwise Bit Clear, AND complement VBIC (register) on page A8-841 ASIMD
10 Vector Bitwise OR, if source registers differ VORR (register) on page A8-977 ASIMD
Vector Move, if source registers identical VMOV (register) on page A8-939 ASIMD
10 Vector Bitwise Insert if True VBIF, VBIT, VBSL on page A8-843 ASIMD
11 Vector Bitwise Insert if False VBIF, VBIT, VBSL on page A8-843 ASIMD
0011 0 - - Vector Compare Greater Than VCGT (register) on page A8-853 ASIMD
1 - - Vector Compare Greater Than or Equal VCGE (register) on page A8-849 ASIMD
0110 - - - Vector Maximum or Minimum VMAX, VMIN (integer) on page A8-927 ASIMD
0111 0 - - Vector Absolute Difference VABD, VABDL (integer) on page A8-821 ASIMD
1 - - Vector Absolute Difference and Accumulate VABA, VABAL on page A8-819 ASIMD
A7-260 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
1001 0 - - Vector Multiply Accumulate or Subtract VMLA, VMLAL, VMLS, VMLSL (integer) ASIMD
on page A8-931
1011 0 0 - Vector Saturating Doubling Multiply Returning VQDMULH on page A8-1001 ASIMD
High Half
1100 1 0 - Vector Fused Multiply Accumulate or Subtract VFMA, VFMS on page A8-893 ASIMDv2
1 0x Vector Compare Greater Than or Equal VCGE (register) on page A8-849 ASIMD
1 1 - Vector Absolute Compare Greater or Less Than VACGE, VACGT, VACLE, VACLT on ASIMD
(or Equal) page A8-827
a. In this column, ASIMD indicates Advanced SIMD, and ASIMDv2 indicates Advanced SIMDv2.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-261
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
Otherwise, Table A7-10 shows the allocation of encodings in this space. Other encodings in this space are
UNDEFINED.
A U Instruction See
0100 0 Vector Add and Narrow, returning High Half VADDHN on page A8-833
1 Vector Rounding Add and Narrow, returning High Half VRADDHN on page A8-1023
0101 - Vector Absolute Difference and Accumulate VABA, VABAL on page A8-819
0110 0 Vector Subtract and Narrow, returning High Half VSUBHN on page A8-1089
1 Vector Rounding Subtract and Narrow, returning High Half VRSUBHN on page A8-1045
10x0 - Vector Multiply Accumulate or Subtract VMLA, VMLAL, VMLS, VMLSL (integer) on page A8-931
10x1 0 Vector Saturating Doubling Multiply Accumulate or VQDMLAL, VQDMLSL on page A8-999
Subtract Long
1100 - Vector Multiply (integer) VMUL, VMULL (integer and polynomial) on page A8-959
1110 - Vector Multiply (polynomial) VMUL, VMULL (integer and polynomial) on page A8-959
A7-262 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
Otherwise, Table A7-11 shows the allocation of encodings in this space. Other encodings in this space are
UNDEFINED.
A U Instruction See
0x0x - Vector Multiply Accumulate or Subtract VMLA, VMLAL, VMLS, VMLSL (by scalar) on page A8-935
0x10 - Vector Multiply Accumulate or Subtract Long VMLA, VMLAL, VMLS, VMLSL (by scalar) on page A8-935
0x11 0 Vector Saturating Doubling Multiply Accumulate or VQDMLAL, VQDMLSL on page A8-999
Subtract Long
1010 - Vector Multiply Long VMUL, VMULL (by scalar) on page A8-963
1100 - Vector Saturating Doubling Multiply returning High VQDMULH on page A8-1001
Half
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-263
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
If [L, imm3] == 0b0000, see One register and a modified immediate value on page A7-267.
Otherwise, Table A7-12 shows the allocation of encodings in this space. Other encodings in this space are
UNDEFINED.
Table A7-12 Data-processing instructions with two registers and a shift amount
A U B L Instruction See
0011 - - - Vector Rounding Shift Right and Accumulate VRSRA on page A8-1043
011x - - - Vector Saturating Shift Left VQSHL, VQSHLU (immediate) on page A8-1017
1 0 0 Vector Saturating Shift Right, Unsigned Narrow VQSHRN, VQSHRUN on page A8-1019
1 0 Vector Saturating Shift Right, Rounded Unsigned VQRSHRN, VQRSHRUN on page A8-1013
Narrow
1001 - 0 0 Vector Saturating Shift Right, Narrow VQSHRN, VQSHRUN on page A8-1019
1 0 Vector Saturating Shift Right, Rounded Narrow VQRSHRN, VQRSHRUN on page A8-1013
A7-264 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
The allocation of encodings in this space is shown in Table A7-13. Other encodings in this space are UNDEFINED.
A B Instruction See
110xx Vector Pairwise Add and Accumulate Long VPADAL on page A8-979
01 x000x Vector Compare Greater Than Zero VCGT (immediate #0) on page A8-855
x001x Vector Compare Greater Than or Equal to Zero VCGE (immediate #0) on page A8-851
x010x Vector Compare Equal to zero VCEQ (immediate #0) on page A8-847
x011x Vector Compare Less Than or Equal to Zero VCLE (immediate #0) on page A8-857
x100x Vector Compare Less Than Zero VCLT (immediate #0) on page A8-861
01001 Vector Saturating Move and Unsigned Narrow VQMOVN, VQMOVUN on page A8-1005
0101x Vector Saturating Move and Narrow VQMOVN, VQMOVUN on page A8-1005
01100 Vector Shift Left Long (maximum shift) VSHLL on page A8-1051
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-265
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
A B Instruction See
11xxx Vector Convert VCVT (between floating-point and integer, Advanced SIMD) on
page A8-869
A7-266 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
Table A7-14 Data-processing instructions with one register and a modified immediate value
1111 UNDEFINED -
Table A7-15 shows the modified immediate constants available with these instructions, and how they are encoded.
- 000x 00000000 00000000 00000000 abcdefgh 00000000 00000000 00000000 abcdefgh I32 c
001x 00000000 00000000 abcdefgh 00000000 00000000 00000000 abcdefgh 00000000 I32 c, d
010x 00000000 abcdefgh 00000000 00000000 00000000 abcdefgh 00000000 00000000 I32 c, d
011x abcdefgh 00000000 00000000 00000000 abcdefgh 00000000 00000000 00000000 I32 c, d
100x 00000000 abcdefgh 00000000 abcdefgh 00000000 abcdefgh 00000000 abcdefgh I16 c
101x abcdefgh 00000000 abcdefgh 00000000 abcdefgh 00000000 abcdefgh 00000000 I16 c, d
1100 00000000 00000000 abcdefgh 11111111 00000000 00000000 abcdefgh 11111111 I32 d, e
1101 00000000 abcdefgh 11111111 11111111 00000000 abcdefgh 11111111 11111111 I32 d, e
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-267
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
Table A7-15 Modified immediate values for Advanced SIMD instructions (continued)
1111 aBbbbbbc defgh000 00000000 00000000 aBbbbbbc defgh000 00000000 00000000 F32 f, g
1 1110 aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh I64 f
1111 UNDEFINED - -
a. In this table, the immediate value is shown in binary form, to relate abcdefgh to the encoding diagram. In assembler
syntax, the constant is specified by a data type and a value of that type. That value is specified in the normal way (a
decimal number by default) and is replicated enough times to fill the 64-bit immediate. For example, a data type of I32
and a value of 10 specify the 64-bit constant 0x0000000A0000000A.
b. This specifies the data type used when the instruction is disassembled. On assembly, the data type must be matched in
the table if possible. Other data types are permitted as pseudo-instructions when a program is assembled, provided the
64-bit constant specified by the data type and value is available for the instruction. If a constant is available in more than
one way, the first entry in this table that can produce it is used. For example, VMOV.I64 D0, #0x8000000080000000 does
not specify a 64-bit constant that is available from the I64 line of the table, but does specify one that is available from
the fourth I32 line or the F32 line. It is assembled to the first of these, and therefore is disassembled as VMOV.I32 D0,
#0x80000000.
c. This constant is available for the VBIC, VMOV, VMVN, and VORR instructions.
d. UNPREDICTABLE if abcdefgh == 00000000.
e. This constant is available for the VMOV and VMVN instructions only.
f. This constant is available for the VMOV instruction only.
g. In this entry, B = NOT(b). The bit pattern represents the floating-point number (–1)S × 2exp × mantissa, where
S = UInt(a), exp = UInt(NOT(b):c:d)-3 and mantissa = (16+UInt(e:f:g:h))/16.
A7-268 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.4 Advanced SIMD data-processing instructions
case cmode<3:1> of
when '000'
testimm8 = FALSE; imm64 = Replicate(Zeros(24):imm8, 2);
when '001'
testimm8 = TRUE; imm64 = Replicate(Zeros(16):imm8:Zeros(8), 2);
when '010'
testimm8 = TRUE; imm64 = Replicate(Zeros(8):imm8:Zeros(16), 2);
when '011'
testimm8 = TRUE; imm64 = Replicate(imm8:Zeros(24), 2);
when '100'
testimm8 = FALSE; imm64 = Replicate(Zeros(8):imm8, 4);
when '101'
testimm8 = TRUE; imm64 = Replicate(imm8:Zeros(8), 4);
when '110'
testimm8 = TRUE;
if cmode<0> == '0' then
imm64 = Replicate(Zeros(16):imm8:Ones(8), 2);
else
imm64 = Replicate(Zeros(8):imm8:Ones(16), 2);
when '111'
testimm8 = FALSE;
if cmode<0> == '0' && op == '0' then
imm64 = Replicate(imm8, 8);
if cmode<0> == '0' && op == '1' then
imm8a = Replicate(imm8<7>, 8); imm8b = Replicate(imm8<6>, 8);
imm8c = Replicate(imm8<5>, 8); imm8d = Replicate(imm8<4>, 8);
imm8e = Replicate(imm8<3>, 8); imm8f = Replicate(imm8<2>, 8);
imm8g = Replicate(imm8<1>, 8); imm8h = Replicate(imm8<0>, 8);
imm64 = imm8a:imm8b:imm8c:imm8d:imm8e:imm8f:imm8g:imm8h;
if cmode<0> == '1' && op == '0' then
imm32 = imm8<7>:NOT(imm8<6>):Replicate(imm8<6>,5):imm8<5:0>:Zeros(19);
imm64 = Replicate(imm32, 2);
if cmode<0> == '1' && op == '1' then
UNDEFINED;
return imm64;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-269
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.5 Floating-point data-processing instructions
If T == 1 in the Thumb encoding or cond == 0b1111 in the ARM encoding, the instruction is UNDEFINED.
Otherwise:
• Table A7-16 shows the encodings for three-register Floating-point data-processing instructions. Other
encodings in this space are UNDEFINED.
• Table A7-17 applies only if Table A7-16 indicates that it does. It shows the encodings for Floating-point
data-processing instructions with two registers or a register and an immediate. Other encodings in this space
are UNDEFINED.
• Table A7-18 on page A7-271 shows the immediate constants available in the VMOV (immediate) instruction.
0x00 - Vector Multiply Accumulate or Subtract VMLA, VMLS (floating-point) on page A8-933 VFPv2
0x01 - Vector Negate Multiply Accumulate or Subtract VNMLA, VNMLS, VNMUL on page A8-971 VFPv2
0x10 x1
1x01 - Vector Fused Negate Multiply Accumulate or VFNMA, VFNMS on page A8-895 VFPv4
Subtract
1x10 - Vector Fused Multiply Accumulate or Subtract VFMA, VFMS on page A8-893 VFPv4
A7-270 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.5 Floating-point data-processing instructions
0111 11 Vector Convert VCVT (between double-precision and single-precision) on page A8-877 VFPv2
1000 x1 Vector Convert VCVT, VCVTR (between floating-point and integer, Floating-point) on VFPv2
page A8-871
101x x1 Vector Convert VCVT (between floating-point and fixed-point, Floating-point) on VFPv3
page A8-875
110x x1 Vector Convert VCVT, VCVTR (between floating-point and integer, Floating-point) on VFPv2
page A8-871
111x x1 Vector Convert VCVT (between floating-point and fixed-point, Floating-point) on VFPv3
page A8-875
F64 abcd efgh aBbbbbbb bbcdefgh 00000000 00000000 00000000 00000000 00000000 00000000
a. In this column, B = NOT(b). The bit pattern represents the floating-point number (–1)S × 2exp × mantissa, where
S = UInt(a), exp = UInt(NOT(b):c:d)-3 and mantissa = (16+UInt(e:f:g:h))/16.
// VFPExpandImm()
// ==============
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-271
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.6 Extension register load/store instructions
The ARM encoding of Advanced SIMD and Floating-point (VFP) Extension register load and store instructions is:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 Opcode Rn 1 0 1
If T == 1 in the Thumb encoding or cond == 0b1111 in the ARM encoding, the instruction is UNDEFINED.
Otherwise, the allocation of encodings in this space is shown in Table A7-19. Other encodings in this space are
UNDEFINED.
These instructions are LDC and STC instructions for coprocessors 10 and 11.
01x00 - Vector Store Multiple (Increment After, no writeback) VSTM on page A8-1081
01x10 - Vector Store Multiple (Increment After, writeback) VSTM on page A8-1081
10x10 not 1101 Vector Store Multiple (Decrement Before, writeback) VSTM on page A8-1081
01x01 - Vector Load Multiple (Increment After, no writeback) VLDM on page A8-923
01x11 not 1101 Vector Load Multiple (Increment After, writeback) VLDM on page A8-923
10x11 - Vector Load Multiple (Decrement Before, writeback) VLDM on page A8-923
A7-272 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.7 Advanced SIMD element or structure load/store instructions
The ARM encoding of Advanced SIMD element load and store instructions is:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 A L 0 B
The ARM instructions can only be executed unconditionally. The Thumb instructions can be executed conditionally
by using the IT instruction. For details see IT on page A8-391.
A B Instruction See
1 0x00 Vector Store VST1 (single element from one lane) on page A8-1067
1000
0x01 Vector Store VST2 (single 2-element structure from one lane) on page A8-1071
1001
0x10 Vector Store VST3 (single 3-element structure from one lane) on page A8-1075
1010
0x11 Vector Store VST4 (single 4-element structure from one lane) on page A8-1079
1011
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-273
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.7 Advanced SIMD element or structure load/store instructions
A B Instruction See
1 0x00 Vector Load VLD1 (single element to one lane) on page A8-901
1000
1100 Vector Load VLD1 (single element to all lanes) on page A8-903
0x01 Vector Load VLD2 (single 2-element structure to one lane) on page A8-907
1001
1101 Vector Load VLD2 (single 2-element structure to all lanes) on page A8-909
0x10 Vector Load VLD3 (single 3-element structure to one lane) on page A8-913
1010
1110 Vector Load VLD3 (single 3-element structure to all lanes) on page A8-915
0x11 Vector Load VLD4 (single 4-element structure to one lane) on page A8-919
1011
1111 Vector Load VLD4 (single 4-element structure to all lanes) on page A8-921
A7-274 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.7 Advanced SIMD element or structure load/store instructions
[<Rn>{:<align>}], <Rm>
The address is contained in ARM core register <Rn>.
Rn is updated by this instruction: Rn = Rn + Rm
Encoded as Rm = Rm. Rm must not be encoded as 0b1111 or 0b1101, the PC or the SP.
If Rn is encoded as 0b1111, the instruction is UNPREDICTABLE.
In all cases, <align> specifies an alignment. Details are given in the individual instruction descriptions.
Previous versions of the document used the @ character for alignment. So, for example, the first format in this section
was shown as [<Rn>{@<align>}]. Both @ and : are supported. However, to ensure portability of code to assemblers
that treat @ as a comment character, : is preferred.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-275
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.8 8, 16, and 32-bit transfer between ARM core and extension registers
A7.8 8, 16, and 32-bit transfer between ARM core and extension registers
The Thumb encoding of Advanced SIMD and Floating-point 8-bit, 16-bit, and 32-bit register data transfer
instructions is:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 T 1 1 1 0 A L 1 0 1 C B 1
The ARM encoding of Advanced SIMD and Floating-point 8-bit, 16-bit, and 32-bit register data transfer
instructions is:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 A L 1 0 1 C B 1
If T == 1 in the Thumb encoding or cond == 0b1111 in the ARM encoding, the instruction is UNDEFINED.
Otherwise, the allocation of encodings in this space is shown in Table A7-22. Other encodings in this space are
UNDEFINED.
These instructions are MRC and MCR instructions for coprocessors 10 and 11.
L C A B Instruction See
0 0 000 - Vector Move VMOV (between ARM core register and single-precision register) on
page A8-945
0 1 0xx - Vector Move VMOV (ARM core register to scalar) on page A8-941
1 0 000 - Vector Move VMOV (between ARM core register and single-precision register) on
page A8-945
1 xxx - Vector Move VMOV (scalar to ARM core register) on page A8-943
A7-276 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.9 64-bit transfers between ARM core and extension registers
The ARM encoding of Advanced SIMD and Floating-point 64-bit register data transfer instructions is:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 0 1 0 1 0 1 C op
If T == 1 in the Thumb encoding or cond == 0b1111 in the ARM encoding, the instruction is UNDEFINED.
Otherwise, the allocation of encodings in this space is shown in Table A7-23. Other encodings in this space are
UNDEFINED.
These instructions are MRRC and MCRR instructions for coprocessors 10 and 11.
C op Instruction
0 00x1 VMOV (between two ARM core registers and two single-precision registers) on page A8-947
1 00x1 VMOV (between two ARM core registers and a doubleword extension register) on page A8-949
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A7-277
ID040418 Non-Confidential
A7 Advanced SIMD and Floating-point Instruction Encoding
A7.9 64-bit transfers between ARM core and extension registers
A7-278 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A8
Instruction Descriptions
Note
The Floating-point Extension was previously described as the VFP Extension, and:
• Different versions of this extension, and the instructions they introduce, are identified using the abbreviation
VFP, for example VFPv3.
• The deprecated vector features of the Floating-point Extension are identified as VFP vectors.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-279
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.1 Format of instruction descriptions
A few instruction descriptions describe alternative mnemonics for other instructions and use an abbreviated and
modified version of this format.
Another use of parenthesized text is to indicate the former mnemonic in some cases where a mnemonic has been
replaced entirely by another mnemonic in the new assembler syntax.
• T1, T2, T3 … for the first, second, third and any additional Thumb encodings
• A1, A2, A3 … for the first, second, third and any additional ARM encodings
• E1, E2, E3 … for the first, second, third and any additional ThumbEE encodings that are not also Thumb
encodings.
Where Thumb and ARM encodings are very closely related, the two encodings are described together, for example
as encoding T1/A1.
• Information about which architecture variants include the particular encoding of the instruction. This is
presented in one of two ways:
— For instruction encodings that are in the main instruction set architecture, as a list of the architecture
variants that include the encoding. See Architecture versions, profiles, and variants on page A1-30 for
a summary of these variants.
— For instruction encodings that are in the architecture extensions, as a list of the architecture extensions
that include the encoding. See Architecture extensions on page A1-32 for a summary of the
architecture extensions and the architecture variants that they can extend.
In architecture variant lists:
— ARMv7 means ARMv7-A and ARMv7-R profiles. The architecture variant information in this manual
does not cover the ARMv7-M profile.
A8-280 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.1 Format of instruction descriptions
— * is used as a wildcard. For example, ARMv5T* means ARMv5T, ARMv5TE, and ARMv5TEJ.
• An assembly syntax that ensures that the assembler selects the encoding in preference to any other encoding.
In some cases, multiple syntaxes are given. The correct one to use is sometimes indicated by annotations to
the syntax, such as Inside IT block and Outside IT block. In other cases, the correct one to use can be
determined by looking at the assembler syntax description and using it to determine which syntax
corresponds to the instruction being disassembled.
There is usually more than one syntax that ensures re-assembly to any particular encoding, and the exact set
of syntaxes that do so usually depends on the register numbers, immediate constants and other operands to
the instruction. For example, when assembling to the Thumb instruction set, the syntax AND R0, R0, R8
ensures selection of a 32-bit encoding but AND R0, R0, R1 selects a 16-bit encoding.
The assembly syntax documented for the encoding is chosen to be the simplest one that ensures selection of
that encoding for all operand combinations supported by that encoding. This often means that it includes
elements that are only necessary for a small subset of operand combinations. For example, the assembler
syntax documented for the 32-bit Thumb AND (register) encoding includes the .W qualifier to ensure that the
32-bit encoding is selected even for the small proportion of operand combinations for which the 16-bit
encoding is also available.
The assembly syntax given for an encoding is therefore a suitable one for a disassembler to disassemble that
encoding to. However, disassemblers might wish to use simpler syntaxes when they are suitable for the
operand combination, in order to produce more readable disassembled code.
• An encoding diagram, or a Thumb encoding diagram followed by an ARM encoding diagram when they are
being described together. This is half-width for 16-bit Thumb encodings and full-width for 32-bit Thumb and
ARM encodings. The 32-bit ARM encoding diagrams number the bits from 31 to 0, while the 32-bit Thumb
encoding diagrams number the bits from 15 to 0 for each halfword, to distinguish them from ARM encodings
and to act as a reminder that a 32-bit Thumb instruction consists of two consecutive halfwords rather than a
word.
In particular, if instructions are stored using the standard little-endian instruction endianness, the encoding
diagram for an ARM instruction at address A shows the bytes at addresses A+3, A+2, A+1, A from left to
right, but the encoding diagram for a 32-bit Thumb instruction shows them in the order A+1, A for the first
halfword, followed by A+3, A+2 for the second halfword.
• Encoding-specific pseudocode. This is pseudocode that translates the encoding-specific instruction fields
into inputs to the encoding-independent pseudocode in the later Operation subsection, and that picks out any
special cases in the encoding. For a detailed description of the pseudocode used and of the relationship
between the encoding diagram, the encoding-specific pseudocode and the encoding-independent
pseudocode, see Appendix D16 Pseudocode Definition.
• One or more syntax prototype lines written in a typewriter font, using the conventions described in
Assembler syntax prototype line conventions on page A8-282. Each prototype line documents the mnemonic
and (where appropriate) operand parts of a full line of assembler code. When there is more than one such line,
each prototype line is annotated to indicate required results of the encoding-specific pseudocode.
For each instruction encoding belonging to a target instruction set, an assembler can use this information to
determine whether it can use that encoding to encode the instruction requested by the UAL source. If multiple
encodings can encode the instruction then:
— If both a 16-bit encoding and a 32-bit encoding can encode the instruction, the architecture prefers the
16-bit encoding. This means the assembler must use the 16-bit encoding rather than the 32-bit
encoding.
Software can use the .W and .N qualifiers to specify the required encoding width, see Standard
assembler syntax fields on page A8-285.
— If multiple encodings of the same length can encode the instruction, the Assembler syntax subsection
says which encoding is preferred, and how software can, instead, select the other encodings.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-281
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.1 Format of instruction descriptions
Each encoding also documents UAL syntax that selects it in preference to any other encoding.
If no encodings of the target instruction set can encode the instruction requested by the UAL source, normally
the assembler generates an error saying that the instruction is not available in that instruction set.
Note
Often, an instruction is available in one instruction set but not in another. The Assembler syntax subsection
identifies many of these cases. For example, the ARM instructions with bits<31:28> == 0b1111 described in
Unconditional instructions on page A5-214 cannot have a condition code, but the equivalent Thumb
instructions often can, and this usually appears in the Assembler syntax subsection as a statement that the
ARM instruction cannot be conditional.
However, some such cases are too complex to describe in the available space, so the definitive test of whether
an instruction is available in a given instruction set is whether there is an available encoding for it in that
instruction set.
• The line where: followed by descriptions of all of the variable or optional fields of the prototype syntax line.
Some syntax fields are standardized across all or most instructions. Standard assembler syntax fields on
page A8-285 describes these fields.
By default, syntax fields that specify registers, such as <Rd>, <Rn>, or <Rt>, can be any of R0-R12 or LR in
Thumb instructions, and any of R0-R12, SP or LR in ARM instructions. These require that the
encoding-specific pseudocode set the corresponding integer variable (such as d, n, or t) to the corresponding
register number, using 0-12 for R0-R12, 13 for SP, or 14 for LR:
— Normally, software can do this by setting the corresponding field in the instruction, typically named
Rd, Rn, Rt, to the binary encoding of that number.
— In the case of 16-bit Thumb encodings, the field is normally of length 3, and so the encoding is only
available when the assembler syntax specifies one of R0-R7. Such encodings often use a register field
name like Rdn. This indicates that the encoding is only available if <Rd> and <Rn> specify the same
register, and that the register number of that register is encoded in the field if they do.
The description of a syntax field that specifies a register sometimes extends or restricts the permitted range
of registers or documents other differences from the default rules for such fields. Examples of extensions are
permitting the use of the SP in a Thumb instruction, or permitting the use of the PC, identified using register
number 15.
• Where appropriate, text that briefly describes changes from the pre-UAL ARM assembler syntax. Where
present, this usually consists of an alternative pre-UAL form of the assembler mnemonic. The pre-UAL
ARM assembler syntax does not conflict with UAL. ARM recommends that it is supported, as an optional
extension to UAL, so that pre-UAL ARM assembler source files can be assembled.
Note
The pre-UAL Thumb assembler syntax is incompatible with UAL and is not documented in the instruction sections.
For details see Appendix D8 Legacy Instruction Mnemonics.
< > Any item bracketed by < and > is a short description of a type of value to be supplied by the user in
that position. A longer description of the item is normally supplied by subsequent text. Such items
often correspond to a similarly named field in an encoding diagram for an instruction. When the
correspondence only requires the binary encoding of an integer value or register number to be
substituted into the instruction encoding, it is not described explicitly. For example, if the assembler
syntax for an ARM instruction contains an item <Rn> and the instruction encoding diagram contains
a 4-bit field named Rn, the number of the register specified in the assembler syntax is encoded in
binary in the instruction field.
A8-282 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.1 Format of instruction descriptions
If the correspondence between the assembler syntax item and the instruction encoding is more
complex than simple binary encoding of an integer or register number, the item description indicates
how it is encoded. This is often done by specifying a required output from the encoding-specific
pseudocode, such as add = TRUE. The assembler must only use encodings that produce that output.
{ } Any item bracketed by { and } is optional. A description of the item and of how its presence or
absence is encoded in the instruction is normally supplied by subsequent text.
Many instructions have an optional destination register. Unless otherwise stated, if such a
destination register is omitted, it is the same as the immediately following source register in the
instruction syntax.
# In the assembler syntax, numeric constants are normally preceded by a #. Some UAL instruction
syntax descriptions explicitly show this # as optional. Any UAL assembler:
• must treat the # as optional where an instruction syntax description shows it as optional
• can treat the # either as mandatory or as optional where an instruction syntax description does
not show it as optional.
Note
ARM recommends that UAL assemblers treat all uses of # shown in this manual as optional.
spaces Single spaces are used for clarity, to separate items. When a space is obligatory in the assembler
syntax, two or more consecutive spaces are used.
All other characters must be encoded precisely as they appear in the assembler syntax. Apart from { and }, the
special characters described above do not appear in the basic forms of assembler instructions documented in this
manual. The { and } characters need to be encoded in a few places as part of a variable item. When this happens,
the long description of the variable item indicates how they must be used.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-283
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.1 Format of instruction descriptions
• Resets and interrupts (both IRQs and FIQs) are not listed. They can occur before or after the execution of any
instruction, and in some cases during the execution of an instruction, but they are not in general caused by
the instruction concerned.
• Prefetch Abort exceptions are normally caused by a memory abort when an instruction is fetched, followed
by an attempt to execute that instruction. This can happen for any instruction, but is caused by the aborted
attempt to fetch the instruction rather than by the instruction itself, and so is not listed. A special case is the
BKPT instruction, that is defined as causing a Prefetch Abort exception in some circumstances.
• Data Abort exceptions are listed for all instructions that perform data memory accesses.
• Undefined Instruction exceptions are listed when they are part of the effects of a defined instruction. For
example, all coprocessor instructions are defined to produce the Undefined Instruction exception if not
accepted by their coprocessor. Undefined Instruction exceptions caused by the execution of an undefined
instruction are not listed, even when the undefined instruction is a special case of one or more of the
encodings of the instruction. Such special cases are instead indicated in the encoding-specific pseudocode for
the encoding.
• Supervisor Call and Secure Monitor Call exceptions are listed for the SVC and SMC instructions respectively.
Supervisor Call exceptions and the SVC instruction were previously called Software Interrupt exceptions and
the SWI instruction. Secure Monitor Call exceptions and the SMC instruction were previously called Secure
Monitor interrupts and the SMI instruction.
Floating-point exceptions are listed for instructions that can produce them. Floating-point exceptions on
page A2-69 describes these exceptions. They do not normally result in processor exceptions.
A8.1.7 Notes
Where appropriate, other notes about the instruction appear under additional subheadings.
Note
Information that was documented in notes in previous versions of the ARM Architecture Reference Manual and its
supplements has often been moved elsewhere. For example, operand restrictions on the values of fields in an
instruction encoding are now normally documented in the encoding-specific pseudocode for that encoding.
A8-284 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.2 Standard assembler syntax fields
<c> Is an optional field. It specifies the condition under which the instruction is executed. See
Conditional execution on page A8-286 for the range of available conditions and their encoding. If
<c> is omitted, it defaults to always (AL).
<q> Specifies optional assembler qualifiers on the instruction. The following qualifiers are defined:
.N Meaning narrow, specifies that the assembler must select a 16-bit encoding for the
instruction. If this is not possible, an assembler error is produced.
.W Meaning wide, specifies that the assembler must select a 32-bit encoding for the
instruction. If this is not possible, an assembler error is produced.
If neither .W nor .N is specified, the assembler can select either 16-bit or 32-bit encodings. If both
are available, it must select a 16-bit encoding. In a few cases, more than one encoding of the same
length can be available for an instruction. The rules for selecting between such encodings are
instruction-specific and are part of the instruction description.
Note
When assembling to the ARM instruction set, the .N qualifier produces an assembler error and
the .W qualifier has no effect.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-285
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.3 Conditional execution
Mnemonic
cond Meaning (integer) Meaning (floating-point) a Condition flags
extension
In Thumb instructions, the condition, if it is not AL, is normally encoded in a preceding IT instruction. For more
information see Conditional instructions on page A4-160 and IT on page A8-391. Some conditional branch
instructions do not require a preceding IT instruction, because they include a condition code in their encoding.
In ARM instructions, bits[31:28] of the instruction contain the condition code, or contain 0b1111 for some ARM
instructions that can only be executed unconditionally.
ARM deprecates the conditional execution of any instruction encoding provided by the Advanced SIMD Extension
that is not also provided by the Floating-point (VFP) extension, and strongly recommends that:
• For ARM instructions, any such Advanced SIMD instruction that can be conditionally executed is executed
with the <c> field omitted or set to AL.
Note
This applies only to VDUP, see VDUP (ARM core register) on page A8-887. The other instructions do not
permit conditional execution in ARM state.
A8-286 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.3 Conditional execution
• For Thumb instructions, such Advanced SIMD instructions are never included in an IT block. This means
they must be specified with the <c> field omitted or set to AL.
This deprecation does not apply to Advanced SIMD instruction encodings that are also available as Floating-point
instruction encodings. That is, it does not apply to the Advanced SIMD encodings of the instructions described in
the following sections:
• VLDM on page A8-923.
• VLDR on page A8-925.
• VMOV (ARM core register to scalar) on page A8-941.
• VMOV (between two ARM core registers and a doubleword extension register) on page A8-949.
• VMRS on page A8-955.
• VMSR on page A8-957.
• VPOP on page A8-991.
• VPUSH on page A8-993.
• VSTM on page A8-1081.
• VSTR on page A8-1083.
bits(4) CurrentCond()
• For the T1 and T3 encodings of the Branch instruction (see B on page A8-332), it returns the 4-bit cond field
of the encoding.
The ConditionPassed() function uses this condition specifier and the APSR condition flags to determine whether
the instruction must be executed:
// ConditionPassed()
// =================
boolean ConditionPassed()
cond = CurrentCond();
// Condition flag values in the set ‘111x’ indicate the instruction is always executed.
// Otherwise, invert condition if necessary.
if cond<0> == ‘1’ && cond != ‘1111’ then
result = !result;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-287
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.3 Conditional execution
return result;
Undefined Instruction exception on page B1-1205 describes the handling of conditional instructions that are
UNDEFINED or UNPREDICTABLE. The pseudocode in the manual, as a sequential description of the instructions, has
limitations in this respect. For more information, see Limitations of the instruction pseudocode on page D16-2630.
A8-288 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.4 Shifts applied to a register
ARM data-processing instructions can apply a register-controlled shift to the second operand register.
(omitted) No shift.
LSL #<n> Logical shift left <n> bits. 1 <= <n> <= 31.
LSR #<n> Logical shift right <n> bits. 1 <= <n> <= 32.
ASR #<n> Arithmetic shift right <n> bits. 1 <= <n> <= 32.
ROR #<n> Rotate right <n> bits. 1 <= <n> <= 31.
RRX Rotate right one bit, with extend. Bit[0] is written to shifter_carry_out, bits[31:1] are shifted right
one bit, and the Carry flag is shifted into bit[31].
Note
Assemblers can permit the use of some or all of ASR #0, LSL #0, LSR #0, and ROR #0 to specify that no shift is to be
performed. This is not standard UAL, and the encoding selected for Thumb instructions might vary between UAL
assemblers if it is used. To ensure disassembled code assembles to the original instructions, disassemblers must omit
the shift specifier when the instruction specifies no shift.
Similarly, assemblers can permit the use of #0 in the immediate forms of ASR, LSL, LSR, and ROR instructions to specify
that no shift is to be performed, that is, that a MOV (register) instruction is wanted. Again, this is not standard UAL,
and the encoding selected for Thumb instructions might vary between UAL assemblers if it is used. To ensure
disassembled code assembles to the original instructions, disassemblers must use the MOV (register) syntax when the
instruction specifies no shift.
Encoding
The assembler encodes <shift> into two type bits and five immediate bits, as follows:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-289
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.4 Shifts applied to a register
<type> is the type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
// DecodeImmShift()
// ================
case type of
when ‘00’
shift_t = SRType_LSL; shift_n = UInt(imm5);
when ‘01’
shift_t = SRType_LSR; shift_n = if imm5 == ‘00000’ then 32 else UInt(imm5);
when ‘10’
shift_t = SRType_ASR; shift_n = if imm5 == ‘00000’ then 32 else UInt(imm5);
when ‘11’
if imm5 == ‘00000’ then
shift_t = SRType_RRX; shift_n = 1;
else
shift_t = SRType_ROR; shift_n = UInt(imm5);
// DecodeRegShift()
// ================
// Shift()
// =======
// Shift_C()
// =========
(bits(N), bit) Shift_C(bits(N) value, SRType type, integer amount, bit carry_in)
assert !(type == SRType_RRX && amount != 1);
if amount == 0 then
(result, carry_out) = (value, carry_in);
else
case type of
when SRType_LSL
(result, carry_out) = LSL_C(value, amount);
A8-290 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.4 Shifts applied to a register
when SRType_LSR
(result, carry_out) = LSR_C(value, amount);
when SRType_ASR
(result, carry_out) = ASR_C(value, amount);
when SRType_ROR
(result, carry_out) = ROR_C(value, amount);
when SRType_RRX
(result, carry_out) = RRX_C(value, carry_in);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-291
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.5 Memory accesses
Offset addressing
The offset value is applied to an address obtained from the base register. The result is used as the
address for the memory access. The value of the base register is unchanged.
The assembly language syntax for this mode is:
[<Rn>, <offset>]
Pre-indexed addressing
The offset value is applied to an address obtained from the base register. The result is used as the
address for the memory access, and written back into the base register.
The assembly language syntax for this mode is:
[<Rn>, <offset>]!
Post-indexed addressing
The address obtained from the base register is used, unchanged, as the address for the memory
access. The offset value is applied to the address, and written back into the base register
The assembly language syntax for this mode is:
[<Rn>], <offset>
For information about unaligned access, endianness, and exclusive access, see:
• Alignment support on page A3-106
• Endian support on page A3-108
• Synchronization and semaphores on page A3-112.
A8-292 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.6 Encoding of lists of ARM core registers
The registers list is encoded in the instruction encoding. Most often, this is done using an 8-bit, 13-bit, or 16-bit
register_list field. This section gives more information about these and other possible register list encodings.
In a register_list field, each bit corresponds to a single register, and if the <registers> field of the assembler
instruction includes Rt then register_list<t> is set to 1, otherwise it is set to 0.
The full rules for the encoding of lists of ARM core registers are:
• Except for the cases listed here, 16-bit Thumb encodings use an 8-bit register list, and can access only
registers R0-R7.
The exceptions to this rule are:
— The T1 encoding of POP uses an 8-bit register list, and an additional bit, P, that corresponds to the PC.
This means it can access any of R0-R7 and the PC.
— The T1 encoding of PUSH uses an 8-bit register list, and an additional bit, M, that corresponds to the LR.
This means it can access any of R0-R7 and the LR.
• 32-bit Thumb encodings of load operations use a 13-bit register list, and two additional bits, M, corresponding
to the LR, and P, corresponding to the PC. This means these instructions can access any of R0-R12 and the
LR and PC.
• 32-bit Thumb encodings of store operations use a 13-bit register list, and one additional bit, M, corresponding
to the LR. This means these instructions can access any of R0-R12 and the LR.
• Except for the case listed here, ARM encodings use a 16-bit register list. This means these instructions can
access any of R0-R12 and the SP, LR, and PC.
The exception to this rule is:
— The system instructions LDM (exception return) and LDM (User registers) use a 15-bit register list. This
means these instructions can access any of R0-R12 and the SP and LR.
• The T3 and A2 encodings of POP, and the T3 and A2 encodings of PUSH, access a single register from the set
of registers {R0-R12, LR, PC} and encode the register number in the Rt field.
Note
POP is a load operation, and PUSH is a store operation.
In every case, the encoding-specific pseudocode converts the register list into a 32-bit variable, registers, with a
bit corresponding to each of the registers R0-R12, SP, LR, and PC.
Note
Some Floating-point and Advanced SIMD instructions operate on lists of Advanced SIMD and Floating-point
extension registers. The assembler syntax of these instructions includes a <list> field that specifies the registers to
be operated on, and the description of the instruction in Alphabetical list of instructions on page A8-298 defines the
use and encoding of this field.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-293
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.7 Additional pseudocode support for instruction descriptions
The following subsection gives additional pseudocode support functions for some of the instructions described in
Alphabetical list of instructions on page A8-298:
// Coproc_Accepted()
// =================
// Determines whether the coprocessor instruction is accepted.
return CPxInstrDecode(instr);
A8-294 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.7 Additional pseudocode support for instruction descriptions
two_reg = TRUE;
elsif instr<27:25> == ‘110’ && instr<31:28> != ‘1111’ && instr<22> == ‘0’ then
// LDC/STC
opc1 = 0; // only use of LDC/STC is for Debug
if UInt(instr<15:12>) != 5 then UNDEFINED;
else
UNDEFINED;
case opc1 of
// Does not consider possible traps of Debug and Trace registers from
// Non-secure modes to Hyp mode here.
when 0 return CP14DebugInstrDecode(instr);
when 1 return CP14TraceInstrDecode(instr);
when 6
// ThumbEE registers - fully decoded here
if two_reg then UNDEFINED;
if instr<7:5> != ‘000’ || instr<3:1> != ‘000’ ||
instr<15:12> == ‘1111’ then
UNPREDICTABLE;
else
if instr<0> == ‘0’ then
if !CurrentModeIsNotUser() then UNDEFINED;
if instr<1> == ‘1’ then
if !CurrentModeIsNotUser() && TEECR.XED == ‘1’ then UNDEFINED;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-295
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.7 Additional pseudocode support for instruction descriptions
HSRString<19:16> = instr<7:4>;
HSRString<13:10> = instr<19:16>;
HSRString<8:5> = instr<15:12>;
HSRString<4:1> = instr<3:0>;
HSRString<0> = instr<20>;
WriteHSR(‘000100’, HSRString);
else
HSRString<19:17> = instr<7:5>;
HSRString<16:14> = instr<23:21>;
HSRString<13:10> = instr<19:16>;
HSRString<8:5> = instr<15:12>;
HSRString<4:1> = instr<3:0>;
HSRString<0> = instr<20>;
WriteHSR(‘000011’, HSRString);
TakeHypTrapException();
return CP15InstrDecode(instr);
The Coproc_DoneLoading() pseudocode function determines, for an LDC instruction, whether enough words have been
loaded:
The Coproc_DoneStoring() function determines for an STC instruction whether enough words have been stored:
The Coproc_GetOneWord() function obtains the word for an MRC instruction from the coprocessor:
The Coproc_GetTwoWords() function obtains the two words for an MRRC instruction from the coprocessor:
Note
The relative significance of the two words returned is IMPLEMENTATION DEFINED, but all uses within this manual
present the two words in the order (most significant, least significant).
The Coproc_GetWordToStore() function obtains the next word to store for an STC instruction from the coprocessor:
The Coproc_InternalOperation() procedure instructs a coprocessor to perform the internal operation requested by a
CDP instruction:
The Coproc_SendLoadedWord() procedure sends a loaded word for an LDC instruction to the coprocessor:
A8-296 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.7 Additional pseudocode support for instruction descriptions
The Coproc_SendOneWord() procedure sends the word for an MCR instruction to the coprocessor:
The Coproc_SendTwoWords() procedure sends the two words for an MCRR instruction to the coprocessor:
Note
The relative significance of word2 and word1 is IMPLEMENTATION DEFINED, but all uses within this manual treat word2
as more significant than word1.
The CPxInstrDecode() pseudocode function decodes an accepted access to a coprocessor other than CP10, CP11,
CP14, or CP15:
The CP14DebugInstrDecode() pseudocode function decodes an accepted access to a CP14 debug register:
The CP14JazelleInstrDecode() pseudocode function decodes an accepted access to a CP14 Jazelle register:
The CP14TraceInstrDecode() pseudocode function decodes an accepted access to a CP14 Trace register:
// CallSupervisor()
// ================
//
// Calls the Supervisor, with appropriate trapping etc
CallSupervisor(bits(16) immediate)
if CurrentModeIsHyp() ||
(HaveVirtExt() && !IsSecure() && !CurrentModeIsNotUser() && HCR.TGE == ‘1’) then
// will be taken to Hyp mode so must set HSR
HSRString = Zeros(25);
HSRString<15:0> = if CurrentCond() == ‘1110’ then immediate else bits(16) UNKNOWN;
WriteHSR(‘010001’, HSRString);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-297
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This section is formatted so that a full description of an instruction uses a double page.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 0 1 0 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 1 0 1 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’); imm32 = ARMExpandImm(imm12);
A8-298 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADC{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the
address calculated by the operation. This is an interworking branch, see Pseudocode details of
operations on ARM core registers on page A2-46. ARM deprecates this use of PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions. ARM deprecates this use of PC.
<const> The immediate value to be added to the value obtained from <Rn>. See Modified immediate constants
in Thumb instructions on page A6-230 or Modified immediate constants in ARM instructions on
page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], imm32, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-299
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 1 0 1 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 0 1 0 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 1 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-300 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions. ARM deprecates this use of the
PC.
<Rm> The optionally shifted second operand register. The PC can be used in ARM instructions. ARM
deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and any encoding is permitted. Shifts applied to a register on page A8-289 describes
the shifts and how they are encoded.
In Thumb assembly:
• outside an IT block, if ADCS <Rd>, <Rn>, <Rd> has <Rd> and <Rn> both in the range R0-R7, it is assembled using
encoding T1 as though ADCS <Rd>, <Rn> had been written.
• inside an IT block, if ADC<c> <Rd>, <Rn>, <Rd> has <Rd> and <Rn> both in the range R0-R7, it is assembled
using encoding T1 as though ADC<c> <Rd>, <Rn> had been written.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-301
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 1 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-302 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-303
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 1 0 imm3 Rn Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 0 Rdn imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 0 0 0 S Rn 0 imm3 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 0 0 0 0 Rn 0 imm3 Rd imm8
A8-304 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const> All encodings permitted
ADDW{<c>}{<q>} {<Rd>,} <Rn>, #<const> Only encoding T4 permitted
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rn> The first operand register. If <Rn> is SP, see ADD (SP plus immediate) on page A8-314. If <Rn> is
PC, see ADR on page A8-320.
<const> The immediate value to be added to the value obtained from <Rn>. The range of values is 0-7 for
encoding T1, 0-255 for encoding T2 and 0-4095 for encoding T4. See Modified immediate constants
in Thumb instructions on page A6-230 for the range of values for encoding T3.
When multiple encodings of the same length are available for an instruction, encoding T3 is preferred to encoding
T4 (if encoding T4 is required, use the ADDW syntax). Encoding T1 is preferred to encoding T2 if <Rd> is specified
and encoding T2 is preferred to encoding T1 if <Rd> is omitted.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], imm32, ‘0’);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-305
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 1 0 0 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-306 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998.
If S is not specified and <Rd> is the PC, the instruction is a branch to the address calculated by the
operation. This is an interworking branch, see Pseudocode details of operations on ARM core
registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. If the SP is specified for <Rn>, see ADD (SP plus immediate) on
page A8-314. If the PC is specified for <Rn>, see ADR on page A8-320.
<const> The immediate value to be added to the value obtained from <Rn>. See Modified immediate constants
in ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], imm32, ‘0’);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-307
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 0 0 Rm Rn Rd
Encoding T2 ARMv6T2, ARMv7 if <Rdn> and <Rm> are both from R0-R7
ARMv4T, ARMv5T*, ARMv6*, ARMv7 otherwise
ADD<c> <Rdn>, <Rm> If <Rdn> is the PC, must be outside or last in IT block.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 0 0 Rm Rdn
DN
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 0 0 0 S Rn (0) imm3 Rd imm2 type Rm
A8-308 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see CMN (register) on page A8-364. If
omitted, <Rd> is the same as <Rn> and encoding T2 is preferred to encoding T1 inside an IT block. If
<Rd> is present, encoding T1 is preferred to encoding T2.
If <Rd> is the PC and S is not specified, encoding T2 is used and the instruction is a branch to the
address calculated by the operation. This is a simple branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
<Rn> The first operand register. The PC can be used in encoding T2. If <Rn> is SP, see ADD (SP plus
register, Thumb) on page A8-316.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in
encoding T2
<shift> The shift to apply to the value read from <Rm>. If present, only encoding T3 is permitted. If omitted,
no shift is applied and any encoding is permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Inside an IT block, if ADD<c> <Rd>, <Rn>, <Rd> cannot be assembled using encoding T1, it is assembled using
encoding T2 as though ADD<c> <Rd>, <Rn> had been written. To prevent this happening, use the .W qualifier.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, ‘0’);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-309
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 0 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
if Rn == ‘1101’ then SEE ADD (SP plus register);
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-310 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998. If omitted, <Rd> is the same as <Rn>.
If <Rd> is the PC and S is not specified, the instruction is a branch to the address calculated by the
operation. This is an interworking branch, see Pseudocode details of operations on ARM core
registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used. If <Rn> is SP, see ADD (SP plus register, Thumb) on
page A8-316.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used.
<shift> The shift to apply to the value read from <Rm>. If present, only encoding T3 or A1 is permitted. If
omitted, no shift is applied and any encoding is permitted. Shifts applied to a register on
page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, ‘0’);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-311
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 0 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-312 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, ‘0’);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-313
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 0 1 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 0 0 0 0 imm7
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 0 0 0 S 1 1 0 1 0 imm3 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 0 0 0 0 1 1 0 1 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 1 0 0 S 1 1 0 1 Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); setflags = (S == ‘1’); imm32 = ARMExpandImm(imm12);
A8-314 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} SP, #<const> All encodings permitted
ADDW{<c>}{<q>} {<Rd>,} SP, #<const> Only encoding T4 is permitted
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998. If omitted, <Rd>
is SP.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<const> The immediate value to be added to the value obtained from SP. Values are multiples of 4 in the
range 0-1020 for encoding T1, multiples of 4 in the range 0-508 for encoding T2 and any value in
the range 0-4095 for encoding T4. See Modified immediate constants in Thumb instructions on
page A6-230 or Modified immediate constants in ARM instructions on page A5-197 for the range
of values for encodings T3 and A1.
When both 32-bit encodings are available for an instruction, encoding T3 is preferred to encoding
T4.
Note
If encoding T4 is required, use the ADDW syntax.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(SP, imm32, ‘0’);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-315
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 0 0 1 1 0 1 Rdm
DM
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 0 0 1 Rm 1 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 0 0 0 S 1 1 0 1 (0) imm3 Rd imm2 type Rm
A8-316 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} SP, <Rm>{, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see CMN (register) on page A8-364.
This register can be SP. If omitted, <Rd> is SP. This register can be the PC, but if it is, encoding T3
is not permitted. ARM deprecates using the PC.
If <Rd> is the PC and S is not specified, encoding T1 is used and the instruction is a branch to the
address calculated by the operation. This is a simple branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
<Rm> The register that is optionally shifted and used as the second operand. This register can be the PC,
but if it is, encoding T3 is not permitted. ARM deprecates using the PC. This register can be the SP,
but:
• ARM deprecates using the SP
• only encoding T1 is available and so the instruction can only be ADD SP, SP, SP.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied and any encoding is
permitted. If present, only encoding T3 is permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
If <Rd> is SP or omitted, <shift> is only permitted to be omitted, LSL #1, LSL #2, or LSL #3.
The pre-UAL syntax ADD<c>S is equivalent to ADDS<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(SP, shifted, ‘0’);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-317
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 0 S 1 1 0 1 Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-318 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADD{S}{<c>}{<q>} {<Rd>,} SP, <Rm>{, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998. This register can be SP. If omitted, <Rd> is SP. This register
can be the PC, but ARM deprecates using the PC.
If S is not specified and <Rd> is the PC, the instruction is a branch to the address calculated by the
operation. This is an interworking branch, see Pseudocode details of operations on ARM core
registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rm> The register that is optionally shifted and used as the second operand. This register can be the PC,
but ARM deprecates using the PC. This register can be the SP, but ARM deprecates using the SP.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied and any encoding is
permitted. Shifts applied to a register on page A8-289 describes the shifts and how they are
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(SP, shifted, ‘0’);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-319
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.12 ADR
This instruction adds an immediate value to the PC value to form a PC-relative address, and writes the result to the
destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 0 0 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 1 0 1 0 1 1 1 1 0 imm3 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 0 0 0 0 1 1 1 1 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 1 0 0 0 1 1 1 1 Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 0 1 0 0 1 1 1 1 Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-320 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ADR{<c>}{<q>} <Rd>, <label> Normal syntax
ADD{<c>}{<q>} <Rd>, PC, #<const> Alternative for encodings T1, T3, A1
SUB{<c>}{<q>} <Rd>, PC, #<const> Alternative for encoding T2, A2
where:
<Rd> The destination register. In ARM instructions, if <Rd> is the PC, the instruction is a branch to the
address calculated by the operation. This is an interworking branch, see Pseudocode details of
operations on ARM core registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<label> The label of an instruction or literal data item whose address is to be loaded into <Rd>. The assembler
calculates the required value of the offset from the Align(PC, 4) value of the ADR instruction to this
label.
If the offset is zero or positive, encodings T1, T3, and A1 are permitted, with imm32 equal to the
offset.
If the offset is negative, encodings T2 and A2 are permitted, with imm32 equal to the size of the offset.
That is, the use of encoding T2 or A2 indicates that the required offset is minus the value of imm32.
Permitted values of the size of the offset are:
Encoding T1 Multiples of 4 in the range 0 to 1020.
Encodings T2, T3 Any value in the range 0 to 4095.
Encodings A1, A2 Any of the constants described in Modified immediate constants in ARM
instructions on page A5-197.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = if add then (Align(PC,4) + imm32) else (Align(PC,4) - imm32);
if d == 15 then // Can only occur for ARM encodings
ALUWritePC(result);
else
R[d] = result;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-321
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 0 0 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 0 0 0 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
A8-322 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
AND{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions. ARM deprecates this use of the
PC.
<const> The immediate value to be ANDed with the value obtained from <Rn>. See Modified immediate
constants in Thumb instructions on page A6-230 or Modified immediate constants in ARM
instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] AND imm32;
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-323
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 0 0 0 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 0 0 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 0 0 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-324 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
AND{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions. ARM deprecates this use of the
PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions. ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
In Thumb assembly:
• outside an IT block, if ANDS <Rd>, <Rn>, <Rd> has <Rd> and <Rn> both in the range R0-R7, it is assembled using
encoding T1 as though ANDS <Rd>, <Rn> had been written
• inside an IT block, if AND<c> <Rd>, <Rn>, <Rd> has <Rd> and <Rn> both in the range R0-R7, it is assembled
using encoding T1 as though AND<c> <Rd>, <Rn> had been written.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] AND shifted;
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-325
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 0 0 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-326 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
AND{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] AND shifted;
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-327
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 0 imm5 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S 1 1 1 1 (0) imm3 Rd imm2 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 1 0 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(-, shift_n) = DecodeImmShift(‘10’, imm5);
A8-328 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ASR{S}{<c>}{<q>} {<Rd>,} <Rm>, #<imm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
Note
Before ARMv7, this was a simple branch.
<Rm> The first operand register. The PC can be used in ARM instructions. ARM deprecates this use of the
PC.
<imm> The shift amount, in the range 1 to 32. See Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry) = Shift_C(R[m], SRType_ASR, shift_n, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-329
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 1 0 0 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 1 0 S Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 1 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-330 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ASR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[m]<7:0>);
(result, carry) = Shift_C(R[n], SRType_ASR, shift_n, APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-331
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.18 B
Branch causes a branch to a target address.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 1 cond imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 0 imm11
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 S cond imm6 1 0 J1 0 J2 imm11
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 S imm10 1 0 J1 1 J2 imm11
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 1 0 imm24
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-332 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
B{<c>}{<q>} <label>
where:
Note
Encodings T1 and T3 are conditional in their own right, and do not require an IT instruction to make
them conditional.
For encodings T1 and T3, <c> must not be AL or omitted. The 4-bit encoding of the condition is
placed in the instruction and not in a preceding IT instruction, and the instruction must not be in an
IT block. As a result, encodings T1 and T2 are never both available to the assembler, nor are
encodings T3 and T4.
<label> The label of the instruction that is to be branched to. The assembler calculates the required value of
the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32
to that offset.
Permitted offsets are:
Encoding T1 Even numbers in the range –256 to 254
Encoding T2 Even numbers in the range –2048 to 2046
Encoding T3 Even numbers in the range –1048576 to 1048574
Encoding T4 Even numbers in the range –16777216 to 16777214
Encoding A1 Multiples of 4 in the range –33554432 to 33554428.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
BranchWritePC(PC + imm32);
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-333
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.19 BFC
Bit Field Clear clears any number of adjacent bits at any position in a register, without affecting the other bits in the
register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 0 1 1 0 1 1 1 1 0 imm3 Rd imm2 (0) msb
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 1 1 0 msb Rd lsb 0 0 1 1 1 1 1
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-334 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BFC{<c>}{<q>} <Rd>, #<lsb>, #<width>
where:
<lsb> The least significant bit that is to be cleared, in the range 0 to 31. This determines the required value
of lsbit.
<width> The number of bits to be cleared, in the range 1 to 32-<lsb>. The required value of msbit is
<lsb>+<width>-1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if msbit >= lsbit then
R[d]<msbit:lsbit> = Replicate(‘0’, msbit-lsbit+1);
// Other bits of R[d] are unchanged
else
UNPREDICTABLE;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-335
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.20 BFI
Bit Field Insert copies any number of low order bits from a register into the same number of adjacent bits at any
position in the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 0 1 1 0 Rn 0 imm3 Rd imm2 (0) msb
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 1 1 0 msb Rd lsb 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-336 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BFI{<c>}{<q>} <Rd>, <Rn>, #<lsb>, #<width>
where:
<lsb> The least significant destination bit, in the range 0 to 31. This determines the required value of lsbit.
<width> The number of bits to be copied, in the range 1 to 32-<lsb>. The required value of msbit is
<lsb>+<width>-1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if msbit >= lsbit then
R[d]<msbit:lsbit> = R[n]<(msbit-lsbit):0>;
// Other bits of R[d] are unchanged
else
UNPREDICTABLE;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-337
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 0 1 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 1 1 0 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
A8-338 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BIC{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The register that contains the operand. The PC can be used in ARM instructions. ARM deprecates
this use of the PC.
<const> The immediate value to be bitwise inverted and ANDed with the value obtained from <Rn>. See
Modified immediate constants in Thumb instructions on page A6-230 or Modified immediate
constants in ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] AND NOT(imm32);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-339
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 1 1 0 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 0 1 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 0 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-340 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BIC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions. ARM deprecates this use of the
PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions. ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] AND NOT(shifted);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-341
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 0 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-342 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BIC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] AND NOT(shifted);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-343
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.24 BKPT
Breakpoint causes a software breakpoint to occur.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 imm12 0 1 1 1 imm4
A8-344 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BKPT{<q>} {#}<imm>
where:
<q> See Standard assembler syntax fields on page A8-285. A BKPT instruction must be unconditional.
<imm> Specifies a value that is stored in the instruction, in the range 0-255 for a Thumb instruction or
0-65535 for an ARM instruction. This value is ignored by the processor, but can be used by a
debugger to store more information about the breakpoint.
Operation
EncodingSpecificOperations();
BKPTInstrDebugEvent();
Exceptions
Prefetch Abort.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-345
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Branch with Link and Exchange Instruction Sets (immediate) calls a subroutine at a PC-relative address, and
changes instruction set from ARM to Thumb, or from Thumb to ARM.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 S imm10 1 1 J1 1 J2 imm11
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 S imm10H 1 1 J1 0 J2 imm10L H
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 1 1 imm24
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 H imm24
A8-346 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BL{X}{<c>}{<q>} <label>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM BLX (immediate) instruction must
be unconditional.
X If present, specifies a change of instruction set (from ARM to Thumb or from Thumb to ARM). If
X is omitted, the processor remains in the same state. For ThumbEE instructions, specifying X is
not permitted.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if CurrentInstrSet() == InstrSet_ARM then
LR = PC - 4;
else
LR = PC<31:1> : ‘1’;
if targetInstrSet == InstrSet_ARM then
targetAddress = Align(PC,4) + imm32;
else
targetAddress = PC + imm32;
SelectInstrSet(targetInstrSet);
BranchWritePC(targetAddress);
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-347
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 1 1 1 Rm (0) (0) (0)
m = UInt(Rm);
if m == 15 then UNPREDICTABLE;
if InITBlock() && !LastInITBlock() then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
m = UInt(Rm);
if m == 15 then UNPREDICTABLE;
A8-348 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BLX{<c>}{<q>} <Rm>
where:
<Rm> The register that contains the branch target address and instruction set selection bit. This register can
be the SP in both ARM and Thumb instructions, but ARM deprecates this use of the SP.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
target = R[m];
if CurrentInstrSet() == InstrSet_ARM then
next_instr_addr = PC - 4;
LR = next_instr_addr;
else
next_instr_addr = PC - 2;
LR = next_instr_addr<31:1> : ‘1’;
BXWritePC(target);
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-349
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.27 BX
Branch and Exchange causes a branch to an address and instruction set specified by a register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 1 1 0 Rm (0) (0) (0)
m = UInt(Rm);
if InITBlock() && !LastInITBlock() then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
m = UInt(Rm);
A8-350 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BX{<c>}{<q>} <Rm>
where:
<Rm> The register that contains the branch target address and instruction set selection bit. The PC can be
used. This register can be the SP in both ARM and Thumb instructions, but ARM deprecates this
use of the SP.
Note
If <Rm> is the PC in a Thumb instruction at a non word-aligned address, it results in UNPREDICTABLE
behavior because the address passed to the BXWritePC() pseudocode function has bits<1:0> = '10'.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
BXWritePC(R[m]);
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-351
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.28 BXJ
Branch and Exchange Jazelle attempts to change to Jazelle state. If the attempt fails, it branches to an address and
instruction set specified by a register as though it were a BX instruction.
In an implementation that includes the Virtualization Extensions, if HSTR.TJDBX is set to 1, execution of a BXJ
instruction in a Non-secure mode other than Hyp mode generates a Hyp Trap exception. For more information see
Trapping accesses to Jazelle functionality on page B1-1254.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 1 0 0 Rm 1 0 (0) 0 (1) (1) (1) (1) (0) (0) (0) (0) (0) (0) (0) (0)
m = UInt(Rm);
if m IN {13,15} then UNPREDICTABLE;
if InITBlock() && !LastInITBlock() then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) 0 0 1 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
m = UInt(Rm);
if m == 15 then UNPREDICTABLE;
A8-352 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
BXJ{<c>}{<q>} <Rm>
where:
<Rm> The register that specifies the branch target address and instruction set selection bit to be used if the
attempt to switch to Jazelle state fails.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if HaveVirtExt() && !IsSecure() && !CurrentModeIsHyp() && HSTR.TJDBX == ‘1’ then
HSRString = Zeros(25);
HSRString<3:0> = m;
WriteHSR(‘001010’, HSRString);
TakeHypTrapException();
elsif JMCR.JE == ‘0’ || CurrentInstrSet() == InstrSet_ThumbEE then
BXWritePC(R[m]);
else
if JazelleAcceptsExecution() then
SwitchToJazelleExecution();
else
SUBARCHITECTURE_DEFINED handler call;
Exceptions
Hyp Trap.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-353
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 op 0 i 1 imm5 Rn
A8-354 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CB{N}Z{<q>} <Rn>, <label>
where:
N If specified, causes the branch to occur when the contents of <Rn> are nonzero (encoded as op = 1).
If omitted, causes the branch to occur when the contents of <Rn> are zero (encoded as op = 0).
<q> See Standard assembler syntax fields on page A8-285. A CBZ or CBNZ instruction must be
unconditional.
<label> The label of the instruction that is to be branched to. The assembler calculates the required value of
the offset from the PC value of the CBZ or CBNZ instruction to this label, then selects an encoding that
sets imm32 to that offset. Permitted offsets are even numbers in the range 0 to 126.
Operation
EncodingSpecificOperations();
if nonzero != IsZero(R[n]) then
BranchWritePC(PC + imm32);
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-355
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the opc1, opc2, CRd, CRn, and CRm fields.
However, coprocessors CP8-CP15 are reserved for use by ARM, and this manual defines the valid CDP and CDP2
instructions when coproc is in the range p8-p15. For more information see Coprocessor support on page A2-93 and
General behavior of system control registers on page B5-1768.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 opc1 CRn CRd coproc opc2 0 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 opc1 CRn CRd coproc opc2 0 CRm
For the case when cond is 0b1111, see the T2 and A2 encoding.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 opc1 CRn CRd coproc opc2 0 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 opc1 CRn CRd coproc opc2 0 CRm
A8-356 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CDP{2}{<c>}{<q>} <coproc>, {#}<opc1>, <CRd>, <CRn>, <CRm> {, {#}<opc2>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM CDP2 instruction must be
unconditional.
<coproc> The name of the coprocessor, and causes the corresponding coprocessor number to be placed in the
cp_num field of the instruction. The generic coprocessor names are p0-p15.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
Coproc_InternalOperation(cp, ThisInstr());
Exceptions
Undefined Instruction.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-357
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.31 CHKA
CHKA is a ThumbEE instruction, see CHKA on page A9-1124.
A8.8.32 CLREX
Clear-Exclusive clears the local record of the executing processor that an address has had a request for an exclusive
access.
Encoding T1 ARMv7
CLREX<c>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 1 (1) (1) (1) (1) 1 0 (0) 0 (1) (1) (1) (1) 0 0 1 0 (1) (1) (1) (1)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 1 0 1 1 1 (1) (1) (1) (1) (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 1 (1) (1) (1) (1)
A8-358 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CLREX{<c>}{<q>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM CLREX instruction must be
unconditional.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
ClearExclusiveLocal(ProcessorID());
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-359
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.33 CLZ
Count Leading Zeros returns the number of binary zero bits before the first binary one bit in a value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 1 Rm 1 1 1 1 Rd 1 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 1 0 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); m = UInt(Rm);
if d == 15 || m == 15 then UNPREDICTABLE;
A8-360 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CLZ{<c>}{<q>} <Rd>, <Rm>
where:
<Rm> The register that contains the operand. Its number must be encoded twice in encoding T1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = CountLeadingZeroBits(R[m]);
R[d] = result<31:0>;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-361
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 0 0 0 1 Rn 0 imm3 1 1 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 1 1 1 Rn (0) (0) (0) (0) imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-362 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CMN{<c>}{<q>} <Rn>, #<const>
where:
<Rn> The register that contains the operand. SP can be used in Thumb and ARM instructions. The PC can
be used in ARM instructions, but ARM deprecates this use of the PC.
<const> The immediate value to be added to the value obtained from <Rn>. See Modified immediate constants
in Thumb instructions on page A6-230 or Modified immediate constants in ARM instructions on
page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], imm32, ‘0’);
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-363
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 0 1 1 Rm Rn
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = (SRType_LSL, 0);
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 0 0 0 1 Rn (0) imm3 1 1 1 1 imm2 type Rm
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm3:imm2);
if n == 15 || m IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 1 1 Rn (0) (0) (0) (0) imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-364 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CMN{<c>}{<q>} <Rn>, <Rm> {, <shift>}
where:
<Rn> The first operand register. SP can be used in Thumb instructions (encoding T2) and in ARM
instructions. The PC can be used in ARM instructions, but ARM deprecates this use of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, ‘0’);
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-365
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 1 1 Rn (0) (0) (0) (0) Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-366 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CMN{<c>}{<q>} <Rn>, <Rm>, <type> <Rs>
where:
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], shifted, ‘0’);
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-367
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 1 Rn imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 1 0 1 1 Rn 0 imm3 1 1 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 1 0 1 Rn (0) (0) (0) (0) imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-368 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CMP{<c>}{<q>} <Rn>, #<const>
where:
<Rn> The first operand register. SP can be used in Thumb instructions (encoding T2) and in ARM
instructions. The PC can be used in ARM instructions, but ARM deprecates this use of the PC.
<const> The immediate value to be compared with the value obtained from <Rn>. The range of values is
0-255 for encoding T1. See Modified immediate constants in Thumb instructions on page A6-230
or Modified immediate constants in ARM instructions on page A5-197 for the range of values for
encoding T2 and A1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], NOT(imm32), ‘1’);
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-369
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 0 1 0 Rm Rn
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = (SRType_LSL, 0);
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 0 1 N Rm Rn
n = UInt(N:Rn); m = UInt(Rm);
(shift_t, shift_n) = (SRType_LSL, 0);
if n < 8 && m < 8 then UNPREDICTABLE;
if n == 15 || m == 15 then UNPREDICTABLE;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 1 0 1 1 Rn (0) imm3 1 1 1 1 imm2 type Rm
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm3:imm2);
if n == 15 || m IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 0 1 Rn (0) (0) (0) (0) imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
A8-370 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CMP{<c>}{<q>} <Rn>, <Rm> {, <shift>}
where:
<Rn> The first operand register. The SP can be used. The PC can be used in ARM instructions, but ARM
deprecates this use of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC. The SP can be used in both ARM and Thumb
instructions, but:
• ARM deprecates the use of SP
• when assembling for the Thumb instruction set, only encoding T2 is available.
<shift> The shift to apply to the value read from <Rm>. If present, encodings T1 and T2 are not permitted. If
absent, no shift is applied and all encodings are permitted. Shifts applied to a register on
page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], NOT(shifted), ‘1’);
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-371
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 0 1 Rn (0) (0) (0) (0) Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
A8-372 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CMP{<c>}{<q>} <Rn>, <Rm>, <type> <Rs>
where:
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], NOT(shifted), ‘1’);
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-373
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.40 CPS
Change Processor State is a system instruction, see CPS (Thumb) on page B9-1964 and CPS (ARM) on
page B9-1966.
A8-374 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.41 CPY
Copy is a pre-UAL synonym for MOV (register).
Assembler syntax
CPY <Rd>, <Rn>
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-375
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.42 CSDB
Consumption of Speculative Data Barrier is a memory barrier that controls speculative execution and data value
prediction.
No instruction other than branch instructions and instructions that write to the PC appearing in program order after
the CSDB can be speculatively executed using the results of any:
• APSR.{N, Z, C, V} predictions of any instructions other than conditional branch instructions and conditional
instructions that write to the PC appearing in program order before the CSDB that have not been
architecturally resolved.
Note
For purposes of the definition of CSDB, APSR.{N, Z, C, V} is not considered a data value. This definition permits:
• Speculative execution of conditional data processing instructions after the CSDB, unless they use the results
of data value or APSR.{N, Z, C, V} predictions of instructions appearing in program order before the CSDB
that have not been architecturally resolved.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 0 0 0 1 0 1 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 1 0 1 0 0
A8-376 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
CSDB{<c>}{<q>}
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
ConsumptionOfSpeculativeDataBarrier();
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-377
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.43 DBG
Debug Hint provides a hint to debug and related systems. See their documentation for what use (if any) they make
of this instruction.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 1 1 1 1 option
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 1 1 1 1 option
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Assembler syntax
DBG{<c>}{<q>} #<option>
where:
<option> Provides extra information about the hint, and is in the range 0 to 15.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
Hint_Debug(option);
Exceptions
None.
A8-378 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.44 DMB
Data Memory Barrier is a memory barrier that ensures the ordering of observations of memory accesses, see Data
Memory Barrier (DMB) on page A3-149.
Encoding T1 ARMv7
DMB<c> <option>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 1 (1) (1) (1) (1) 1 0 (0) 0 (1) (1) (1) (1) 0 1 0 1 option
Encoding A1 ARMv7
DMB <option>
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 1 0 1 1 1 (1) (1) (1) (1) (1) (1) (1) (1) (0) (0) (0) (0) 0 1 0 1 option
Assembler syntax
DMB{<c>}{<q>} {<option>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM DMB instruction must be
unconditional.
Note
The instruction supports the following alternative <option> values, but ARM recommends that
software does not use these alternative values:
• SH as an alias for ISH
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-379
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Operation
if ConditionPassed() then
EncodingSpecificOperations();
case option of
when ‘0010’ domain = MBReqDomain_OuterShareable; types = MBReqTypes_Writes;
when ‘0011’ domain = MBReqDomain_OuterShareable; types = MBReqTypes_All;
when ‘0110’ domain = MBReqDomain_Nonshareable; types = MBReqTypes_Writes;
when ‘0111’ domain = MBReqDomain_Nonshareable; types = MBReqTypes_All;
when ‘1010’ domain = MBReqDomain_InnerShareable; types = MBReqTypes_Writes;
when ‘1011’ domain = MBReqDomain_InnerShareable; types = MBReqTypes_All;
when ‘1110’ domain = MBReqDomain_FullSystem; types = MBReqTypes_Writes;
otherwise domain = MBReqDomain_FullSystem; types = MBReqTypes_All;
if HaveVirtExt() && !IsSecure() && !CurrentModeIsHyp() then
if HCR.BSU == ‘11’ then
domain = MBReqDomain_FullSystem;
if HCR.BSU == ‘10’ && domain != MBReqDomain_FullSystem then
domain = MBReqDomain_OuterShareable;
if HCR.BSU == ‘01’ && domain == MBReqDomain_Nonshareable then
domain = MBReqDomain_InnerShareable;
DataMemoryBarrier(domain, types);
Exceptions
None.
A8-380 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.45 DSB
Data Synchronization Barrier is a memory barrier that ensures the completion of memory accesses, see Data
Synchronization Barrier (DSB) on page A3-150.
Encoding T1 ARMv7
DSB<c> <option>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 1 (1) (1) (1) (1) 1 0 (0) 0 (1) (1) (1) (1) 0 1 0 0 option
Encoding A1 ARMv7
DSB <option>
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 1 0 1 1 1 (1) (1) (1) (1) (1) (1) (1) (1) (0) (0) (0) (0) 0 1 0 0 option
Assembler syntax
DSB{<c>}{<q>} {<option>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM DSB instruction must be
unconditional.
Note
The instruction supports the following alternative <option> values, but ARM recommends that
software does not use these alternative values:
• SH as an alias for ISH
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-381
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Operation
if ConditionPassed() then
EncodingSpecificOperations();
case option of
when ‘0010’ domain = MBReqDomain_OuterShareable; types = MBReqTypes_Writes;
when ‘0011’ domain = MBReqDomain_OuterShareable; types = MBReqTypes_All;
when ‘0110’ domain = MBReqDomain_Nonshareable; types = MBReqTypes_Writes;
when ‘0111’ domain = MBReqDomain_Nonshareable; types = MBReqTypes_All;
when ‘1010’ domain = MBReqDomain_InnerShareable; types = MBReqTypes_Writes;
when ‘1011’ domain = MBReqDomain_InnerShareable; types = MBReqTypes_All;
when ‘1110’ domain = MBReqDomain_FullSystem; types = MBReqTypes_Writes;
otherwise domain = MBReqDomain_FullSystem; types = MBReqTypes_All;
DataSynchronizationBarrier(domain, types);
Exceptions
None.
A8-382 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.46 ENTERX
ENTERX causes a change from Thumb state to ThumbEE state, or has no effect in ThumbEE state. For details see
ENTERX, LEAVEX on page A9-1116.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 1 0 0 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 0 0 1 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-383
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
EOR{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The register that contains the operand. The PC can be used in ARM instructions, but ARM
deprecates this use of the PC.
<const> The immediate value to be exclusive ORed with the value obtained from <Rn>. See Modified
immediate constants in Thumb instructions on page A6-230 or Modified immediate constants in
ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] EOR imm32;
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-384 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 0 0 1 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 1 0 0 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 0 1 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-385
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
EOR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted.Shifts applied to a register on page A8-289 describes
the shifts and how they are encoded.
In Thumb assembly:
• outside an IT block, if EORS <Rd>, <Rn>, <Rd> has <Rd> and <Rn> both in the range R0-R7, it is assembled using
encoding T1 as though EORS <Rd>, <Rn> had been written
• inside an IT block, if EOR<c> <Rd>, <Rn>, <Rd> has <Rd> and <Rn> both in the range R0-R7, it is assembled
using encoding T1 as though EOR<c> <Rd>, <Rn> had been written.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] EOR shifted;
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-386 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 0 1 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-387
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
EOR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] EOR shifted;
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-388 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.50 ERET
Exception Return is a system instruction, see ERET on page B9-1968.
FLDMX, FSTMX
Encodings T1/A1 of the VLDM, VPOP, VPUSH, and VSTM instructions contain an imm8 field that is set to twice the number
of doubleword registers to be transferred. ARM deprecates use of these encodings with an odd value in imm8, and
there is no UAL syntax for them.
The pre-UAL mnemonics FLDMX and FSTMX result in the same instructions as FLDMD (VLDM.64 or VPOP.64) and FSTMD
(VSTM.64 or VPUSH.64) respectively, except that imm8 is equal to twice the number of doubleword registers plus one:
• from ARMv6, ARM deprecates use of FLDMX and FSTMX, except for disassembly purposes, and for reassembly
of disassembled code
• if an FLDMX or FSTMX instruction accesses any register in the range D16-D32, the instruction is UNPREDICTABLE.
A8.8.53 HVC
Hypervisor Call is a system instruction, see HVC on page B9-1970.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-389
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.54 ISB
Instruction Synchronization Barrier flushes the pipeline in the processor, so that all instructions following the ISB
are fetched from cache or memory, after the instruction has been completed. It ensures that the effects of context
changing operations executed before the ISB instruction are visible to the instructions fetched after the ISB. Context
changing operations include changing the Address Space Identifier (ASID), TLB maintenance operations, branch
predictor maintenance operations, and all changes to the CP15 registers. In addition, any branches that appear in
program order after the ISB instruction are written into the branch prediction logic with the context that is visible
after the ISB instruction. This is needed to ensure correct execution of the instruction stream.
Encoding T1 ARMv7
ISB<c> <option>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 1 (1) (1) (1) (1) 1 0 (0) 0 (1) (1) (1) (1) 0 1 1 0 option
Encoding A1 ARMv7
ISB <option>
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 1 0 1 1 1 (1) (1) (1) (1) (1) (1) (1) (1) (0) (0) (0) (0) 0 1 1 0 option
Assembler syntax
ISB{<c>}{<q>} {<option>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM ISB instruction must be
unconditional.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
InstructionSynchronizationBarrier();
Exceptions
None.
A8-390 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.55 IT
If-Then makes up to four following instructions (the IT block) conditional. The conditions for the instructions in the
IT block are the same as, or the inverse of, the condition the IT instruction specifies for the first instruction in the
block.
The IT instruction itself does not affect the condition flags, but the execution of the instructions in the IT block can
change the condition flags.
16-bit instructions in the IT block, other than CMP, CMN and TST, do not set the condition flags. An IT instruction with
the AL condition can be used to get this changed behavior without conditional execution.
The architecture permits exception return to an instruction in the IT block only if the restoration of the CPSR
restores ITSTATE to a state consistent with the conditions specified by the IT instruction. Any other exception return
to an instruction in an IT block is UNPREDICTABLE. Any branch to a target instruction in an IT block is not permitted,
and if such a branch is made it is UNPREDICTABLE what condition is used when executing that target instruction and
any subsequent instruction in the IT block.
See also Conditional instructions on page A4-160 and Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 firstcond mask
Assembler syntax
IT{<x>{<y>{<z>}}}{<q>} <firstcond>
where:
<x> The condition for the second instruction in the IT block.
<y> The condition for the third instruction in the IT block.
<z> The condition for the fourth instruction in the IT block.
<q> See Standard assembler syntax fields on page A8-285. An IT instruction must be unconditional.
<firstcond> The condition for the first instruction in the IT block. See Table A8-1 on page A8-286 for the range
of conditions available, and the encodings.
E Else. The condition for the instruction is the inverse of <firstcond>. The condition code is the same
as <firstcond>, except that the least significant bit is inverted. E must not be specified if <firstcond>
is AL.
Table A8-2 on page A8-392 shows how the values of <x>, <y>, and <z> determine the value of the mask field.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-391
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The conditions specified in an IT instruction must match those specified in the syntax of the instructions in its IT
block. When assembling to ARM code, assemblers check IT instruction syntax for validity but do not generate
assembled instructions for them. See Conditional instructions on page A4-160.
Operation
EncodingSpecificOperations();
ITSTATE.IT<7:0> = firstcond:mask;
Exceptions
None.
A8-392 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the D bit, the CRd field, and in the Unindexed
addressing mode only, the imm8 field. However, coprocessors CP8-CP15 are reserved for use by ARM, and this
manual defines the valid LDC and LDC2 instructions when coproc is in the range p8-p15. For more information see
Coprocessor support on page A2-93.
In an implementation that includes the Virtualization Extensions, the permitted LDC access to a system control
register can be trapped to Hyp mode, meaning that an attempt to execute an LDC instruction in a Non-secure mode
other than Hyp mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap
exception. For more information, see Trapping general CP14 accesses to debug registers on page B1-1258.
For more information about these instructions, see General behavior of system control registers on page B3-1442
or General behavior of system control registers on page B5-1768.
Note
For simplicity, the LDC pseudocode does not show this possible trap to Hyp mode.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 1 Rn CRd coproc imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 1 Rn CRd coproc imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 P U D W 1 Rn CRd coproc imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 P U D W 1 Rn CRd coproc imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-393
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Advanced SIMD and Floating-point See Extension register load/store instructions on page A7-272
Assembler syntax
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>{, #+/-<imm>}] Offset. P = 1, W = 0.
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>, #+/-<imm>]! Pre-indexed. P = 1, W = 1.
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>], #+/-<imm> Post-indexed. P = 0, W = 1.
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>], <option> Unindexed. P = 0, W = 0, U = 1.
where:
L If specified, selects the D == 1 form of the encoding. If omitted, selects the D == 0 form.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM LDC2 instruction must be
unconditional.
<coproc> The name of the coprocessor. The generic coprocessor names are p0-p15.
<Rn> The base register. The SP can be used. For PC use see LDC, LDC2 (literal) on page A8-395.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE, encoded
as U ==1), or – if it is to be subtracted (add == FALSE, encoded as U==0). #0 and #-0 generate
different instructions.
<imm> The immediate offset used for forming the address. Values are multiples of 4 in the range 0-1020.
For the offset addressing syntax, <imm> can be omitted, meaning an offset of +0.
<option> A coprocessor option. An integer in the range 0-255 enclosed in { }. Encoded in imm8.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
repeat
Coproc_SendLoadedWord(MemA[address,4], cp, ThisInstr());
address = address + 4;
until Coproc_DoneLoading(cp, ThisInstr());
if wback then R[n] = offset_addr;
Exceptions
Undefined Instruction, Data Abort, Hyp Trap.
A8-394 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the D bit, the CRd field, and in the Unindexed
addressing mode only, the imm8 field. However, coprocessors CP8-CP15 are reserved for use by ARM, and this
manual defines the valid LDC and LDC2 instructions when coproc is in the range p8-p15. For more information see
Coprocessor support on page A2-93 and General behavior of system control registers on page B5-1768.
In an implementation that includes the Virtualization Extensions, the permitted LDC access to a system control
register can be trapped to Hyp mode, meaning that an attempt to execute an LDC instruction in a Non-secure mode
other than Hyp mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap
exception. For more information, see Trapping general CP14 accesses to debug registers on page B1-1258.
Note
For simplicity, the LDC pseudocode does not show this possible trap to Hyp mode.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 1 1 1 1 1 CRd coproc imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 1 1 1 1 1 CRd coproc imm8
For the case when cond is 0b1111, see the T2/A2 encoding.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 P U D W 1 1 1 1 1 CRd coproc imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 P U D W 1 1 1 1 1 CRd coproc imm8
Advanced SIMD and Floating-point See Extension register load/store instructions on page A7-272
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-395
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, <label> Normal form with P = 1, W = 0
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [PC, #+/-<imm>] Alternative form with P = 1, W = 0
LDC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [PC], <option> Unindexed form with P = 0, U = 1, W = 0,
encoding A1/A2 only
where:
2 If specified, selects encoding T2/A2. If omitted, selects encoding T1/A1.
L If specified, selects the D == 1 form of the encoding. If omitted, selects the D == 0 form.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM LDC2 instruction must be
unconditional.
<coproc> The name of the coprocessor. The generic coprocessor names are p0-p15.
<CRd> The coprocessor destination register.
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are multiples of 4 in the range -1020 to 1020.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE (encoded as U == 1).
If the offset is negative, imm32 is equal to minus the offset and add == FALSE (encoded as U == 0).
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
The unindexed form is permitted for the ARM instruction set only. In it, <option> is a coprocessor option, written
as an integer 0-255 enclosed in { } and encoded in imm8.
The pre-UAL syntax LDC<c>L is equivalent to LDCL<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
NullCheckIfThumbEE(15);
offset_addr = if add then (Align(PC,4) + imm32) else (Align(PC,4) - imm32);
address = if index then offset_addr else Align(PC,4);
repeat
Coproc_SendLoadedWord(MemA[address,4], cp, ThisInstr());
address = address + 4;
until Coproc_DoneLoading(cp, ThisInstr());
Exceptions
Undefined Instruction, Data Abort, Hyp Trap.
A8-396 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 1 Rn register_list
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 0 W 1 Rn P M (0) register_list
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-397
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDM{<c>}{<q>} <Rn>{!}, <registers>
where:
<Rn> The base register. SP can be used. If it is the SP and ! is specified, the instruction is treated as
described in POP (Thumb) on page A8-535.
! Causes the instruction to write a modified value back to <Rn>. Encoded as W = 1. If ! is omitted, the
instruction does not change <Rn> in this way. Encoded as W = 0.
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
Encoding T2 does not support a list containing only one register. If an LDMIA instruction with just
one register <Rt> in the list is assembled to Thumb and encoding T1 is not available, it is assembled
to the equivalent LDR{<c>}{<q>} <Rt>, [<Rn>]{, #4} instruction.
The SP cannot be in the list.
The PC can be in the list. If it is, the instruction branches to the address loaded to the PC. In
ARMv5T and above, this is an interworking branch, see Pseudocode details of operations on ARM
core registers on page A2-46. If the PC is in the list:
• the LR must not be in the list
• the instruction must be either outside any IT block, or the last instruction in an IT block.
If ! is specified, <registers> cannot include the base register.
LDMIA and LDMFD are pseudo-instructions for LDM. LDMFD refers to its use for popping data from Full Descending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers<15> == ‘1’ then
LoadWritePC(MemA[address,4]);
if wback && registers<n> == ‘0’ then R[n] = R[n] + 4*BitCount(registers);
if wback && registers<n> == ‘1’ then R[n] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-398 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 0 1 0 W 1 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if W == ‘1’ && Rn == ‘1101’ && BitCount(register_list) > 1 then SEE POP (ARM);
n = UInt(Rn); registers = register_list; wback = (W == ‘1’);
if n == 15 || BitCount(registers) < 1 then UNPREDICTABLE;
if wback && registers<n> == ‘1’ && ArchVersion() >= 7 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-399
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDM{<c>}{<q>} <Rn>{!}, <registers>
where:
<Rn> The base register. SP can be used. If the SP is used, ! is specified, and there is more than one register
in the <registers> list, the instruction is treated as described in POP (ARM) on page A8-537.
! Causes the instruction to write a modified value back to <Rn>. Encoded as W = 1. If ! is omitted, the
instruction does not change <Rn> in this way. Encoded as W = 0.
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
The SP can be in the list. However, ARM deprecates using these instructions with SP in the list.
The PC can be in the list. If it is, the instruction branches to the address loaded to the PC. In
ARMv5T and above, this is an interworking branch, see Pseudocode details of operations on ARM
core registers on page A2-46.
ARM deprecates using these instructions with both the LR and the PC in the list.
Instructions with the base register in the list and ! specified are only available before ARMv7, and
ARM deprecates the use of such instructions. The value of the base register after such an instruction
is UNKNOWN.
LDMIA and LDMFD are pseudo-instructions for LDM. LDMFD refers to its use for popping data from Full Descending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers<15> == ‘1’ then
LoadWritePC(MemA[address,4]);
if wback && registers<n> == ‘0’ then R[n] = R[n] + 4*BitCount(registers);
if wback && registers<n> == ‘1’ then R[n] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-400 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.60 LDMDA/LDMFA
Load Multiple Decrement After (Load Multiple Full Ascending) loads multiple registers from consecutive memory
locations using an address from a base register. The consecutive memory locations end at this address, and the
address just below the lowest of those locations can optionally be written back to the base register. The registers
loaded can include the PC, causing a branch to a loaded address.
Related system instructions are LDM (User registers) on page B9-1974 and LDM (exception return) on
page B9-1972.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 0 0 0 W 1 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-401
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDMDA{<c>}{<q>} <Rn>{!}, <registers>
where:
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
The SP can be in the list. However, instructions that include the SP in the list are deprecated.
The PC can be in the list. If it is, the instruction branches to the address (data) loaded to the PC. In
ARMv5T and above, this branch is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
ARM deprecates including both LR and PC in the list.
Instructions with the base register in the list and ! specified are only available before ARMv7, and
ARM deprecates the use of such instructions. The value of the base register after such an instruction
is UNKNOWN.
LDMFA is a pseudo-instruction for LDMDA, referring to its use for popping data from Full Ascending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
address = R[n] - 4*BitCount(registers) + 4;
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers<15> == ‘1’ then
LoadWritePC(MemA[address,4]);
if wback && registers<n> == ‘0’ then R[n] = R[n] - 4*BitCount(registers);
if wback && registers<n> == ‘1’ then R[n] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-402 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.61 LDMDB/LDMEA
Load Multiple Decrement Before (Load Multiple Empty Ascending) loads multiple registers from consecutive
memory locations using an address from a base register. The consecutive memory locations end just below this
address, and the address of the lowest of those locations can optionally be written back to the base register. The
registers loaded can include the PC, causing a branch to a loaded address.
Related system instructions are LDM (User registers) on page B9-1974 and LDM (exception return) on
page B9-1972.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 1 0 0 W 1 Rn P M (0) register_list
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 1 0 0 W 1 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-403
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDMDB{<c>}{<q>} <Rn>{!}, <registers>
where:
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
Encoding T1 does not support a list containing only one register. If an LDMDB instruction with just
one register <Rt> in the list is assembled to Thumb, it is assembled to the equivalent LDR{<c>}{<q>}
<Rt>, [<Rn>, #-4]{!} instruction.
The SP can be in the list in ARM instructions, but not in Thumb instructions. However, ARM
instructions that include the SP in the list are deprecated.
The PC can be in the list. If it is, the instruction branches to the address loaded to the PC. In
ARMv5T and above, this is an interworking branch, see Pseudocode details of operations on ARM
core registers on page A2-46. In Thumb instructions, if the PC is in the list:
• the LR must not be in the list
• the instruction must be either outside any IT block, or the last instruction in an IT block.
For the ARM instruction set, ARM deprecates including both LR and PC in the list.
Instructions with the base register in the list and ! specified are only available in the ARM
instruction set before ARMv7, and ARM deprecates the use of such instructions. The value of the
base register after such an instruction is UNKNOWN.
LDMEA is a pseudo-instruction for LDMDB, referring to its use for popping data from Empty Ascending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] - 4*BitCount(registers);
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers<15> == ‘1’ then
LoadWritePC(MemA[address,4]);
if wback && registers<n> == ‘0’ then R[n] = R[n] - 4*BitCount(registers);
if wback && registers<n> == ‘1’ then R[n] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-404 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.62 LDMIB/LDMED
Load Multiple Increment Before (Load Multiple Empty Descending) loads multiple registers from consecutive
memory locations using an address from a base register. The consecutive memory locations start just above this
address, and the address of the last of those locations can optionally be written back to the base register. The registers
loaded can include the PC, causing a branch to a loaded address.
Related system instructions are LDM (User registers) on page B9-1974 and LDM (exception return) on
page B9-1972.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 1 1 0 W 1 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-405
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDMIB{<c>}{<q>} <Rn>{!}, <registers>
where:
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
The SP can be in the list. However, instructions that include the SP in the list are deprecated.
The PC can be in the list. If it is, the instruction branches to the address (data) loaded to the PC. In
ARMv5T and above, this branch is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
ARM deprecates including both LR and PC in the list.
Instructions with the base register in the list and ! specified are only available before ARMv7, and
ARM deprecates the use of such instructions. The value of the base register after such an instruction
is UNKNOWN.
LDMED is a pseudo-instruction for LDMIB, referring to its use for popping data from Empty Descending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
address = R[n] + 4;
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers<15> == ‘1’ then
LoadWritePC(MemA[address,4]);
if wback && registers<n> == ‘0’ then R[n] = R[n] + 4*BitCount(registers);
if wback && registers<n> == ‘1’ then R[n] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-406 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 0 1 imm5 Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 1 Rt imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 1 0 1 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 1 Rn Rt 1 P U W imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-407
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDR{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDR{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDR{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The destination register. The SP can be used. The PC can be used, provided the instruction is either
outside an IT block or the last instruction of an IT block. If the PC is used, the instruction branches
to the address (data) loaded to the PC. In ARMv5T and above, this branch is an interworking branch,
see Pseudocode details of operations on ARM core registers on page A2-46.
<Rn> The base register. The SP can be used. For PC use see LDR (literal) on page A8-411.
+/- + or omitted The immediate offset is to be added to the base register value (add == TRUE,
encoded as U == 1 in encoding T4).
– The immediate offset is to be subtracted from the base register value.
Encoding T4 must be used, with add == FALSE, encoded as U == 0.
#0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Values are:
Encoding T1 Multiples of 4 in the range 0-124.
Encoding T2 Multiples of 4 in the range 0-1020.
Encoding T3 Any value in the range 0-4095.
Encoding T4 Any value in the range 0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
data = MemU[address,4];
if wback then R[n] = offset_addr;
if t == 15 then
if address<1:0> == ‘00’ then LoadWritePC(data); else UNPREDICTABLE;
elsif UnalignedSupport() || address<1:0> == ‘00’ then
R[t] = data;
else R[t] = bits(32) UNKNOWN; // Can only apply before ARMv7
Exceptions
Data Abort.
ThumbEE instruction
ThumbEE has additional LDR (immediate) encodings, see LDR (immediate) on page A9-1128.
A8-408 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 P U 0 W 1 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-409
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDR{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDR{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDR{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The destination register. The SP or the PC can be used. If the PC is used, the instruction branches
to the address (data) loaded to the PC. In ARMv5T and above, this branch is an interworking branch,
see Pseudocode details of operations on ARM core registers on page A2-46.
<Rn> The base register. The SP can be used. For PC use see LDR (literal) on page A8-411.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE, encoded
as U ==1), or – if it is to be subtracted (add == FALSE, encoded as U ==0). #0 and #-0 generate
different instructions.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Any value in the range 0-4095 is permitted.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
data = MemU[address,4];
if wback then R[n] = offset_addr;
if t == 15 then
if address<1:0> == ‘00’ then LoadWritePC(data); else UNPREDICTABLE;
elsif UnalignedSupport() || address<1:0> == ‘00’ then
R[t] = data;
else // Can only apply before ARMv7
R[t] = ROR(data, 8*UInt(address<1:0>));
Exceptions
Data Abort.
A8-410 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 1 Rt imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 U 1 0 1 1 1 1 1 Rt imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 P U 0 W 1 1 1 1 1 Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-411
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDR{<c>}{<q>} <Rt>, <label> Normal form
LDR{<c>}{<q>} <Rt>, [PC, #+/-<imm>] Alternative form
where:
<Rt> The destination register. The SP can be used. The PC can be used, provided the instruction is either
outside an IT block or the last instruction of an IT block. If the PC is used, the instruction branches
to the address (data) loaded to the PC. In ARMv5T and above, this branch is an interworking branch,
see Pseudocode details of operations on ARM core registers on page A2-46.
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are:
Encoding T1 Multiples of four in the range 0 to 1020.
Encoding T2 or A1 Any value in the range -4095 to 4095.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE, encoded as U == 1 in
encoding T2.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE, encoded as U == 0.
Negative offset is not available in encoding T1.
Note
In examples in this manual, the syntax =<value> is used for the label of a memory word whose
contents are constant and equal to <value>. The actual syntax for such a label is
assembler-dependent.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(15);
base = Align(PC,4);
address = if add then (base + imm32) else (base - imm32);
data = MemU[address,4];
if t == 15 then
if address<1:0> == ‘00’ then LoadWritePC(data); else UNPREDICTABLE;
elsif UnalignedSupport() || address<1:0> == ‘00’ then
R[t] = data;
else // Can only apply before ARMv7
if CurrentInstrSet() == InstrSet_ARM then
R[t] = ROR(data, 8*UInt(address<1:0>));
else
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-412 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The Thumb form of LDR (register) does not support register writeback.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 1 Rn Rt 0 0 0 0 0 0 imm2 Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-413
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDR{<c>}{<q>} <Rt>, [<Rn>, {+}<Rm>{, <shift>}] Offset addressing
where:
<Rt> The destination register. The SP can be used. The PC can be used, provided the instruction is either
outside an IT block or the last instruction of an IT block. If the PC is used, the instruction branches
to the address (data) loaded to the PC. In ARMv5T and above, this branch is an interworking branch,
see Pseudocode details of operations on ARM core registers on page A2-46.
<Rn> The base register. The SP can be used. In the Thumb instruction set, the PC cannot be used with this
form of the LDR instruction.
+ In Thumb instructions, the optionally shifted value of <Rm> is added to the base register value.
Thumb instructions cannot subtract <Rm> from the base register value.
<Rm> The offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. For encoding T2, <shift> can only be omitted,
encoded as imm2 = 0b00, or LSL #<imm> with <imm> = 1, 2, or 3, and <imm> encoded in imm2.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = (R[n] + offset);
address = offset_addr;
data = MemU[address,4];
if t == 15 then
if address<1:0> == ‘00’ then
LoadWritePC(data);
else
UNPREDICTABLE;
elsif UnalignedSupport() || address<1:0> == ‘00’ then
R[t] = data;
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-414 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 P U 0 W 1 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-415
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDR{<c>}{<q>} <Rt>, [<Rn>, {+/-}<Rm>{, <shift>}] Offset: index==TRUE, wback==FALSE
LDR{<c>}{<q>} <Rt>, [<Rn>, {+/-}<Rm>{, <shift>}]! Pre-indexed: index==TRUE, wback==TRUE
LDR{<c>}{<q>} <Rt>, [<Rn>], {+/-}<Rm>{, <shift>} Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The destination register. The SP can be used. The PC can be used. If the PC is used, the instruction
branches to the address (data) loaded to the PC. In ARMv5T and above, this branch is an
interworking branch, see Pseudocode details of operations on ARM core registers on page A2-46.
<Rn> The base register. The SP can be used. The PC can be used for offset addressing only.
+/- If + or omitted, the optionally shifted value of <Rm> is added to the base register value (add == TRUE
encoded as U == 1).
If –, the optionally shifted value of <Rm> is subtracted from the base register value (add == FALSE
encoded as U == 0).
<Rm> The offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If absent, no shift is applied. Otherwise, see Shifts
applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
data = MemU[address,4];
if wback then R[n] = offset_addr;
if t == 15 then
if address<1:0> == ‘00’ then
LoadWritePC(data);
else
UNPREDICTABLE;
elsif UnalignedSupport() || address<1:0> == ‘00’ then
R[t] = data;
else // Can only apply before ARMv7
R[t] = ROR(data, 8*UInt(address<1:0>));
Exceptions
Data Abort.
A8-416 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 1 imm5 Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 0 0 1 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 0 1 Rn Rt 1 P U W imm8
if Rt == ‘1111’ && P == ‘1’ && U == ‘0’ && W == ‘0’ then SEE PLD, PLDW (immediate);
if Rn == ‘1111’ then SEE LDRB (literal);
if P == ‘1’ && U == ‘1’ && W == ‘0’ then SEE LDRBT;
if P == ‘0’ && W == ‘0’ then UNDEFINED;
t = UInt(Rt); n = UInt(Rn); imm32 = ZeroExtend(imm8, 32);
index = (P == ‘1’); add = (U == ‘1’); wback = (W == ‘1’);
if t == 13 || (t == 15 && W == ‘1’) || (wback && n == t) then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-417
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRB{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRB{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRB{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For PC use see LDRB (literal) on page A8-421.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE, encoded
as U == 1), or – if it is to be subtracted (add == FALSE, encoded as U == 0). #0 and #-0 generate
different instructions.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Values are:
Encoding T1 any value in the range 0-31
Encoding T2 any value in the range 0-4095
Encoding T3 any value in the range 0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
R[t] = ZeroExtend(MemU[address,1], 32);
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-418 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 P U 1 W 1 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-419
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRB{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRB{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRB{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For PC use see LDRB (literal) on page A8-421.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE, encoded
as U == 1), or – if it is to be subtracted (add == FALSE, encoded as U == 0). #0 and #-0 generate
different instructions.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Any value in the range 0-4095 is permitted.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
R[t] = ZeroExtend(MemU[address,1], 32);
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-420 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 U 0 0 1 1 1 1 1 Rt imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 P U 1 W 1 1 1 1 1 Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-421
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRB{<c>}{<q>} <Rt>, <label> Normal form
LDRB{<c>}{<q>} <Rt>, [PC, #+/-<imm>] Alternative form
where:
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are -4095 to 4095.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE, encoded as U == 1.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE, encoded as U == 0.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(15);
base = Align(PC,4);
address = if add then (base + imm32) else (base - imm32);
R[t] = ZeroExtend(MemU[address,1], 32);
Exceptions
Data Abort.
A8-422 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 0 1 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 P U 1 W 1 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-423
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRB{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>{, <shift>}] Offset: index==TRUE, wback==FALSE
LDRB{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>{, <shift>}]! Pre-indexed: index==TRUE, wback==TRUE
LDRB{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm>{, <shift>} Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. In the ARM instruction set the PC can be used, for the offset
addressing form of the instruction only. In the Thumb instruction set, the PC cannot be used with
any of these forms of the LDRB instruction.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE, encoded as U == 1 in encoding A1), or – if it is to be subtracted (permitted in ARM
instructions only, add == FALSE, encoded as U == 0).
<Rm> Contains the offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. For encoding T2, <shift> can only be omitted,
encoded as imm2 = 0b00, or LSL #<imm> with <imm> = 1, 2, or 3, and <imm> encoded in imm2. For
encoding A1, see Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
R[t] = ZeroExtend(MemU[address,1],32);
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-424 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.72 LDRBT
Load Register Byte Unprivileged loads a byte from memory, zero-extends it to form a 32-bit word, and writes it to
a register. For information about memory accesses see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
LDRBT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or an optionally-shifted register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 0 1 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 0 U 1 1 1 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 U 1 1 1 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-425
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRBT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
LDRBT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
LDRBT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> {, <shift>} Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE, encoded as U == 1 in encodings A1 and A2), or – if it is to be subtracted (permitted
in ARM instructions only, add == FALSE, encoded as U == 0).
<imm> The immediate offset applied to the value of <Rn>. Values are 0-255 for encoding T1, and 0-4095 for
encoding A1. <imm> can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then Shift(R[m], shift_t, shift_n, APSR.C) else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
R[t] = ZeroExtend(MemU_unpriv[address,1],32);
if postindex then R[n] = offset_addr;
Exceptions
Data Abort.
A8-426 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 P U 1 W 1 Rn Rt Rt2 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 0 Rn Rt imm4H 1 1 0 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Related encodings See Load/store dual, load/store exclusive, table branch on page A6-236.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-427
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The first destination register. For an ARM instruction, <Rt> must be even-numbered and not R14.
<Rt2> The second destination register. For an ARM instruction, <Rt2> must be <R(t+1)>.
<Rn> The base register. The SP can be used. For PC use see LDRD (literal) on page A8-429.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE, encoded
as U == 1), or – if it is to be subtracted (add == FALSE, encoded as U == 0). #0 and #-0 generate
different instructions.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Values are:
Encoding T1 Multiples of 4 in the range 0-1020.
Encoding A1 Any value in the range 0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
if HaveLPAE() && address<2:0> == ‘000’ then
data = MemA[address,8];
if BigEndian() then
R[t] = data<63:32>;
R[t2] = data<31:0>;
else
R[t] = data<31:0>;
R[t2] = data<63:32>;
else
R[t] = MemA[address,4];
R[t2] = MemA[address+4,4];
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-428 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 P U 1 W 1 1 1 1 1 Rt Rt2 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 (1) U 1 (0) 0 1 1 1 1 Rt imm4H 1 1 0 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Related encodings See Load/store dual, load/store exclusive, table branch on page A6-236.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-429
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRD{<c>}{<q>} <Rt>, <Rt2>, <label> Normal form
LDRD{<c>}{<q>} <Rt>, <Rt2>, [PC, #+/-<imm>] Alternative form
where:
<Rt> The first destination register. For an ARM instruction, <Rt> must be even-numbered and not R14.
<Rt2> The second destination register. For an ARM instruction, <Rt2> must be <R(t+1)>.
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are:
Encoding T1 Multiples of 4 in the range -1020 to 1020.
Encoding A1 Any value in the range -255 to 255.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE, encoded as U == 1.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE, encoded as U == 0.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(15);
address = if add then (Align(PC,4) + imm32) else (Align(PC,4) - imm32);
if HaveLPAE() && address<2:0> == ‘000’ then
data = MemA[address,8];
if BigEndian() then
R[t] = data<63:32>;
R[t2] = data<31:0>;
else
R[t] = data<31:0>;
R[t2] = data<63:32>;
else
R[t] = MemA[address,4];
R[t2] = MemA[address+4,4];
Exceptions
Data Abort.
A8-430 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 0 W 0 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-431
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>, +/-<Rm>] Offset: index==TRUE, wback==FALSE
LDRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>, +/-<Rm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>], +/-<Rm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The first destination register. This register must be even-numbered and not R14.
<Rn> The base register. The SP can be used. The PC can be used, for offset addressing only.
+/- Is + or omitted if the value of <Rm> is to be added to the base register value (add == TRUE, encoded as
U == 1), or – if it is to be subtracted (add == FALSE, encoded as U == 0).
<Rm> Contains the offset that is applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + R[m]) else (R[n] - R[m]);
address = if index then offset_addr else R[n];
if HaveLPAE() && address<2:0> == ‘000’ then
data = MemA[address,8];
if BigEndian() then
R[t] = data<63:32>;
R[t2] = data<31:0>;
else
R[t] = data<31:0>;
R[t2] = data<63:32>;
else
R[t] = MemA[address,4];
R[t2] = MemA[address+4,4];
Exceptions
Data Abort.
A8-432 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.76 LDREX
Load Register Exclusive calculates an address from a base register value and an immediate offset, loads a word from
memory, writes it to a register and:
• if the address has the Shared Memory attribute, marks the physical address as exclusive access for the
executing processor in a global monitor
• causes the executing processor to indicate an active exclusive access in the local monitor.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 0 1 0 1 Rn Rt (1) (1) (1) (1) imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 0 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-433
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDREX{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}]
where:
<imm> The immediate offset added to the value of <Rn> to form the address. <imm> can be omitted, meaning
an offset of 0. Values are:
Encoding T1 multiples of 4 in the range 0-1020
Encoding A1 omitted or 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + imm32;
SetExclusiveMonitors(address,4);
R[t] = MemA[address,4];
Exceptions
Data Abort.
A8-434 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.77 LDREXB
Load Register Exclusive Byte derives an address from a base register value, loads a byte from memory, zero-extends
it to form a 32-bit word, writes it to a register and:
• if the address has the Shared Memory attribute, marks the physical address as exclusive access for the
executing processor in a global monitor
• causes the executing processor to indicate an active exclusive access in the local monitor.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
Encoding T1 ARMv7
LDREXB<c> <Rt>, [<Rn>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 1 Rn Rt (1) (1) (1) (1) 0 1 0 0 (1) (1) (1) (1)
t = UInt(Rt); n = UInt(Rn);
if t IN {13,15} || n == 15 then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 0 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
t = UInt(Rt); n = UInt(Rn);
if t == 15 || n == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-435
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDREXB{<c>}{<q>} <Rt>, [<Rn>]
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
SetExclusiveMonitors(address,1);
R[t] = ZeroExtend(MemA[address,1], 32);
Exceptions
Data Abort.
A8-436 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.78 LDREXD
Load Register Exclusive Doubleword derives an address from a base register value, loads a 64-bit doubleword from
memory, writes it to two registers and:
• if the address has the Shared Memory attribute, marks the physical address as exclusive access for the
executing processor in a global monitor
• causes the executing processor to indicate an active exclusive access in the local monitor.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
Encoding T1 ARMv7
LDREXD<c> <Rt>, <Rt2>, [<Rn>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 1 Rn Rt Rt2 0 1 1 1 (1) (1) (1) (1)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-437
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDREXD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>]
where:
<Rt> The first destination register. For an ARM instruction, <Rt> must be even-numbered and not R14.
<Rt2> The second destination register. For an ARM instruction, <Rt2> must be <R(t+1)>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
// LDREXD requires doubleword-aligned address
if address<2:0> != ‘000’ then AlignmentFault(address, FALSE)
SetExclusiveMonitors(address,8);
// See the description of Single-copy atomicity for details of whether
// the two loads are 64-bit single-copy atomic.
R[t] = MemA[address,4];
R[t2] = MemA[address+4,4];
Exceptions
Data Abort.
A8-438 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.79 LDREXH
Load Register Exclusive Halfword derives an address from a base register value, loads a halfword from memory,
zero-extends it to form a 32-bit word, writes it to a register and:
• if the address has the Shared Memory attribute, marks the physical address as exclusive access for the
executing processor in a global monitor
• causes the executing processor to indicate an active exclusive access in the local monitor.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
Encoding T1 ARMv7
LDREXH<c> <Rt>, [<Rn>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 1 Rn Rt (1) (1) (1) (1) 0 1 0 1 (1) (1) (1) (1)
t = UInt(Rt); n = UInt(Rn);
if t IN {13,15} || n == 15 then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 1 1 Rn Rt (1) (1) (1) (1) 1 0 0 1 (1) (1) (1) (1)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
t = UInt(Rt); n = UInt(Rn);
if t == 15 || n == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-439
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDREXH{<c>}{<q>} <Rt>, [<Rn>]
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
SetExclusiveMonitors(address,2);
R[t] = ZeroExtend(MemA[address,2], 32);
Exceptions
Data Abort.
A8-440 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 imm5 Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 0 1 1 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 1 1 Rn Rt 1 P U W imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-441
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRH{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRH{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRH{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For PC use see LDRH (literal) on page A8-445.
+/- Is + or omitted to indicate that the immediate offset is added to the base register value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Values are:
Encoding T1 multiples of 2 in the range 0-62
Encoding T2 any value in the range 0-4095
Encoding T3 any value in the range 0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
data = MemU[address,2];
if wback then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = ZeroExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-442 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 1 Rn Rt imm4H 1 0 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-443
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRH{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRH{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRH{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For PC use see LDRH (literal) on page A8-445.
+/- Is + or omitted to indicate that the immediate offset is added to the base register value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Any value in the range 0-255 is permitted.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
data = MemU[address,2];
if wback then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = ZeroExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-444 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 U 0 1 1 1 1 1 1 Rt imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 1 1 1 1 1 Rt imm4H 1 0 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-445
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRH{<c>}{<q>} <Rt>, <label> Normal form
LDRH{<c>}{<q>} <Rt>, [PC, #+/-<imm>] Alternative form
where:
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are:
Encoding T1 any value in the range -4095 to 4095
Encoding A1 any value in the range -255 to 255.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(15);
base = Align(PC,4);
address = if add then (base + imm32) else (base - imm32);
data = MemU[address,2];
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = ZeroExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-446 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 1 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 1 1 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 0 W 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-447
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRH{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, LSL #<imm>}] Offset: index==TRUE, wback==FALSE
LDRH{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>] Offset: index==TRUE, wback==FALSE
LDRH{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRH{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. In the ARM instruction set the PC can be used, for offset
addressing forms of the instruction only. In the Thumb instruction set, the PC cannot be used for any
of these forms of the LDRH instruction.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally left shifted and added to the value of <Rn> to form the address.
<imm> If present, the size of the left shift to apply to the value from <Rm>, in the range 1-3. Only encoding
T2 is permitted, and <imm> is encoded in imm2.
If absent, no shift is specified and all encodings are permitted. In encoding T2, imm2 is encoded as
0b00.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
data = MemU[address,2];
if wback then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = ZeroExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-448 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.84 LDRHT
Load Register Halfword Unprivileged loads a halfword from memory, zero-extends it to form a 32-bit word, and
writes it to a register. For information about memory accesses see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
LDRHT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or a register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 1 1 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 0 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-449
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRHT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
LDRHT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
LDRHT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register
value.Encoded as add = TRUE.
Is – if <imm> or the optionally shifted value of <Rm> is to be subtracted from the base register value.
This is permitted in ARM instructions only, and is encoded as add = FALSE.
<imm> The immediate offset applied to the value of <Rn>. Any value in the range 0-255 is permitted. <imm>
can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then R[m] else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
data = MemU_unpriv[address,2];
if postindex then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = ZeroExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-450 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 0 0 1 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 0 1 Rn Rt 1 P U W imm8
if Rt == ‘1111’ && P == ‘1’ && U == ‘0’ && W == ‘0’ then SEE PLI;
if Rn == ‘1111’ then SEE LDRSB (literal);
if P == ‘1’ && U == ‘1’ && W == ‘0’ then SEE LDRSBT;
if P == ‘0’ && W == ‘0’ then UNDEFINED;
t = UInt(Rt); n = UInt(Rn); imm32 = ZeroExtend(imm8, 32);
index = (P == ‘1’); add = (U == ‘1’); wback = (W == ‘1’);
if t == 13 || (t == 15 && W == ‘1’) || (wback && n == t) then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 1 Rn Rt imm4H 1 1 0 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-451
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSB{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRSB{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRSB{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For PC use see LDRSB (literal) on page A8-453.
+/- Is + or omitted to indicate that the immediate offset is added to the base register value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address. For the offset addressing syntax, <imm> can be
omitted, meaning an offset of 0. Values are:
Encoding T1 any value in the range 0-4095
Encoding T2 or A1 any value in the range0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
R[t] = SignExtend(MemU[address,1], 32);
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-452 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 U 0 0 1 1 1 1 1 Rt imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 1 1 1 1 1 Rt imm4H 1 1 0 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-453
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSB{<c>}{<q>} <Rt>, <label> Normal form
LDRSB{<c>}{<q>} <Rt>, [PC, #+/-<imm>] Alternative form
where:
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are:
Encoding T1 any value in the range -4095 to 4095
Encoding A1 any value in the range -255 to 255.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(15);
base = Align(PC,4);
address = if add then (base + imm32) else (base - imm32);
R[t] = SignExtend(MemU[address,1], 32);
Exceptions
Data Abort.
A8-454 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 1 1 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 0 1 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 0 W 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-455
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSB{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, LSL #<imm>}] Offset: index==TRUE, wback==FALSE
LDRSB{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>] Offset: index==TRUE, wback==FALSE
LDRSB{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRSB{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. In the ARM instruction set the PC can be used, for the offset
addressing forms of the instruction only. In the Thumb instruction set, the PC cannot be used for any
of these forms of the LDRSB instruction.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally left shifted and added to the value of <Rn> to form the address.
<imm> If present, the size of the left shift to apply to the value from <Rm>, in the range 1-3. Only encoding
T2 is permitted, and <imm> is encoded in imm2.
If absent, no shift is specified and all encodings are permitted. In encoding T2, imm2 is encoded as
0b00.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
R[t] = SignExtend(MemU[address,1], 32);
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-456 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.88 LDRSBT
Load Register Signed Byte Unprivileged loads a byte from memory, sign-extends it to form a 32-bit word, and
writes it to a register. For information about memory accesses see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
LDRSBT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or a register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 0 1 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 1 0 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-457
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSBT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
LDRSBT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
LDRSBT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<imm> The immediate offset applied to the value of <Rn>. Any value in the range 0-255 is permitted. <imm>
can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then R[m] else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
R[t] = SignExtend(MemU_unpriv[address,1], 32);
if postindex then R[n] = offset_addr;
Exceptions
Data Abort.
A8-458 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 0 1 1 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 1 1 Rn Rt 1 P U W imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 1 Rn Rt imm4H 1 1 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-459
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSH{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
LDRSH{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRSH{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For PC use see LDRSH (literal) on page A8-461.
+/- Is + or omitted to indicate that the immediate offset is added to the base register value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address, Values are 0-4095 for encoding T1, and 0-255
for encoding T2 or A1. For the offset syntax, <imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
data = MemU[address,2];
if wback then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = SignExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-460 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 U 0 1 1 1 1 1 1 Rt imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 1 1 1 1 1 Rt imm4H 1 1 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-461
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSH{<c>}{<q>} <Rt>, <label> Normal form
LDRSH{<c>}{<q>} <Rt>, [PC, #+/-<imm>] Alternative form
where:
<label> The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required
value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of
the offset are:
Encoding T1 any value in the range -4095 to 4095
Encoding A1 any value in the range -255 to 255.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(15);
base = Align(PC,4);
address = if add then (base + imm32) else (base - imm32);
data = MemU[address,2];
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = SignExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-462 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 1 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 1 1 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 0 W 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-463
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSH{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, LSL #<imm>}] Offset: index==TRUE, wback==FALSE
LDRSH{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>] Offset: index==TRUE, wback==FALSE
LDRSH{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>]! Pre-indexed: index==TRUE, wback==TRUE
LDRSH{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. In the ARM instruction set the PC can be used, for the offset
addressing forms of the instruction only. In the Thumb instruction set, the PC cannot be used for any
of these forms of the LDRSH instruction.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally left shifted and added to the value of <Rn> to form the address.
<imm> If present, the size of the left shift to apply to the value from <Rm>, in the range 1-3. Only encoding
T2 is permitted, and <imm> is encoded in imm2.
If absent, no shift is specified and all encodings are permitted. In encoding T2, imm2 is encoded as
0b00.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
data = MemU[address,2];
if wback then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = SignExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-464 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.92 LDRSHT
Load Register Signed Halfword Unprivileged loads a halfword from memory, sign-extends it to form a 32-bit word,
and writes it to a register. For information about memory accesses see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
LDRSHT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or a register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 1 1 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 1 1 1 Rn Rt imm4H 1 1 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 0 1 1 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-465
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRSHT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
LDRSHT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
LDRSHT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<imm> The immediate offset applied to the value of <Rn>. Any value in the range 0-255 is permitted. <imm>
can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then R[m] else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
data = MemU_unpriv[address,2];
if postindex then R[n] = offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
R[t] = SignExtend(data, 32);
else // Can only apply before ARMv7
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-466 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.93 LDRT
Load Register Unprivileged loads a word from memory, and writes it to a register. For information about memory
accesses see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
LDRT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or an optionally-shifted register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 1 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 0 U 0 1 1 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 U 0 1 1 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-467
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LDRT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
LDRT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
LDRT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> {, <shift>} Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<imm> The immediate offset applied to the value of <Rn>. Values are 0-255 for encoding T1, and 0-4095 for
encoding A1. <imm> can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then Shift(R[m], shift_t, shift_n, APSR.C) else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
data = MemU_unpriv[address,4];
if postindex then R[n] = offset_addr;
if UnalignedSupport() || address<1:0> == ‘00’ then
R[t] = data;
else // Can only apply before ARMv7
if CurrentInstrSet() == InstrSet_ARM then
R[t] = ROR(data, 8*UInt(address<1:0>));
else
R[t] = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-468 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.94 LEAVEX
LEAVEX causes a change from ThumbEE to Thumb state, or has no effect in Thumb state. For details see ENTERX,
LEAVEX on page A9-1116.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 imm5 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S 1 1 1 1 (0) imm3 Rd imm2 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 0 0 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
if imm5 == ‘00000’ then SEE MOV (register);
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(-, shift_n) = DecodeImmShift(‘00’, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-469
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LSL{S}{<c>}{<q>} {<Rd>,} <Rm>, #<imm5>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
Note
Before ARMv7, this was a simple branch.
<Rm> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<imm5> The shift amount, in the range 1 to 31. See Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry) = Shift_C(R[m], SRType_LSL, shift_n, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-470 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 0 1 0 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 0 S Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-471
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LSL{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[m]<7:0>);
(result, carry) = Shift_C(R[n], SRType_LSL, shift_n, APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-472 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 imm5 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S 1 1 1 1 (0) imm3 Rd imm2 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 0 1 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(-, shift_n) = DecodeImmShift(‘01’, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-473
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LSR{S}{<c>}{<q>} {<Rd>,} <Rm>, #<imm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
Note
Before ARMv7, this was a simple branch.
<Rm> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<imm> The shift amount, in the range 1 to 32. See Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry) = Shift_C(R[m], SRType_LSR, shift_n, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-474 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 0 1 1 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 1 S Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 0 1 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-475
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
LSR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[m]<7:0>);
(result, carry) = Shift_C(R[n], SRType_LSR, shift_n, APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-476 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the opc1, opc2, CRn, and CRm fields. However,
coprocessors CP8-CP15 are reserved for use by ARM, and this manual defines the valid MCR and MCR2 instructions
when coproc is in the range p8-p15. For more information see Coprocessor support on page A2-93 and General
behavior of system control registers on page B5-1768.
In an implementation that includes the Virtualization Extensions, MCR accesses to system control registers can be
trapped to Hyp mode, meaning that an attempt to execute an MCR instruction in a Non-secure mode other than Hyp
mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap exception. For more
information, see Traps to the hypervisor on page B1-1246.
Note
Because of the range of possible traps to Hyp mode, the MCR pseudocode does not show these possible traps.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 opc1 0 CRn Rt coproc opc2 1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 opc1 0 CRn Rt coproc opc2 1 CRm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 opc1 0 CRn Rt coproc opc2 1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 opc1 0 CRn Rt coproc opc2 1 CRm
Advanced SIMD and See 8, 16, and 32-bit transfer between ARM core and extension registers on
Floating-point page A7-276
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-477
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MCR{2}{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <CRn>, <CRm>{, {#}<opc2>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM MCR2 instruction must be
unconditional.
<coproc> The name of the coprocessor. The generic coprocessor names are p0-p15.
<Rt> Is the ARM core register whose value is transferred to the coprocessor.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
Coproc_SendOneWord(R[t], cp, ThisInstr());
Exceptions
Undefined Instruction, Hyp Trap.
A8-478 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the opc1 and CRm fields. However, coprocessors
CP8-CP15 are reserved for use by ARM, and this manual defines the valid MCRR and MCRR2 instructions when coproc
is in the range p8-p15. For more information see Coprocessor support on page A2-93 and General behavior of
system control registers on page B5-1768.
In an implementation that includes the Virtualization Extensions, MCRR accesses to system control registers can be
trapped to Hyp mode, meaning that an attempt to execute an MCRR instruction in a Non-secure mode other than Hyp
mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap exception. For more
information, see Traps to the hypervisor on page B1-1246.
Note
Because of the range of possible traps to Hyp mode, the MCRR pseudocode does not show these possible traps.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 0 1 0 0 Rt2 Rt coproc opc1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 0 1 0 0 Rt2 Rt coproc opc1 CRm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 0 0 1 0 0 Rt2 Rt coproc opc1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 0 0 1 0 0 Rt2 Rt coproc opc1 CRm
Advanced SIMD and See 64-bit transfers between ARM core and extension registers on page A7-277
Floating-point
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-479
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MCRR{2}{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <Rt2>, <CRm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM MCRR2 instruction must be
unconditional.
<Rt> Is the first ARM core register whose value is transferred to the coprocessor.
<Rt2> Is the second ARM core register whose value is transferred to the coprocessor.
Note
For the architected uses of the MCRR instructions, as described in this manual, Rt2 transfers bits[63:32] of the
selected coprocessor register, and Rt transfers bits[31:0]. For IMPLEMENTATION DEFINED uses of the instructions the
relative significance of Rt2 and Rt is IMPLEMENTATION DEFINED.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
Coproc_SendTwoWords(R[t2], R[t], cp, ThisInstr());
Exceptions
Undefined Instruction, Hyp Trap.
A8-480 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.101 MLA
Multiply Accumulate multiplies two register values, and adds a third register value. The least significant 32 bits of
the result are written to the destination register. These 32 bits do not depend on whether the source register values
are considered to be signed values or unsigned values.
In an ARM instruction, the condition flags can optionally be updated based on the result. Use of this option
adversely affects performance on many processor implementations.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 0 0 Rn Ra Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 0 1 S Rd Ra Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-481
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MLA{S}{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
S can be specified only for the ARM instruction set.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand1 = SInt(R[n]); // operand1 = UInt(R[n]) produces the same final results
operand2 = SInt(R[m]); // operand2 = UInt(R[m]) produces the same final results
addend = SInt(R[a]); // addend = UInt(R[a]) produces the same final results
result = operand1 * operand2 + addend;
R[d] = result<31:0>;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result<31:0>);
if ArchVersion() == 4 then
APSR.C = bit UNKNOWN;
// else APSR.C unchanged
// APSR.V always unchanged
Exceptions
None.
A8-482 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.102 MLS
Multiply and Subtract multiplies two register values, and subtracts the product from a third register value. The least
significant 32 bits of the result are written to the destination register. These 32 bits do not depend on whether the
source register values are considered to be signed values or unsigned values.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 0 0 Rn Ra Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 1 0 Rd Ra Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-483
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MLS{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand1 = SInt(R[n]); // operand1 = UInt(R[n]) produces the same final results
operand2 = SInt(R[m]); // operand2 = UInt(R[m]) produces the same final results
addend = SInt(R[a]); // addend = UInt(R[a]) produces the same final results
result = addend - operand1 * operand2;
R[d] = result<31:0>;
Exceptions
None.
A8-484 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 1 0 S 1 1 1 1 0 imm3 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 0 1 0 0 imm4 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 1 0 1 S (0) (0) (0) (0) Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); setflags = (S == ‘1’); (imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 0 0 imm4 Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-485
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MOV{S}{<c>}{<q>} <Rd>, #<const> All encodings permitted
MOVW{<c>}{<q>} <Rd>, #<const> Only encoding T3 or A2 permitted
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, encoding A2 is not permitted, and for
encoding A1 the instruction is a branch to the address calculated by the operation. This is an
interworking branch, see Pseudocode details of operations on ARM core registers on page A2-46.
ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<const> The immediate value to be placed in <Rd>. The range of values is 0-255 for encoding T1 and 0-65535
for encoding T3 or A2. See Modified immediate constants in Thumb instructions on page A6-230
or Modified immediate constants in ARM instructions on page A5-197 for the range of values for
encoding T2 or A1.
When both 32-bit encodings are available for an instruction, encoding T2 or A1 is preferred to
encoding T3 or A2 (if encoding T3 or A2 is required, use the MOVW syntax).
The pre-UAL syntax MOV<c>S is equivalent to MOVS<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = imm32;
if d == 15 then // Can only occur for encoding A1
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-486 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 1 0 D Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S 1 1 1 1 (0) 0 0 0 Rd 0 0 0 0 Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-487
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MOV{S}{<c>}{<q>} <Rd>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. This register can be the SP or PC. S must not be specified if <Rd> is the SP.
If <Rd> is the PC and S is not specified:
• The instruction causes a branch to the address moved to the PC. This is a simple branch, see
Pseudocode details of operations on ARM core registers on page A2-46.
• The instruction must either be outside an IT block or the last instruction of an IT block.
<Rm> The source register. This register can be the SP or PC. S must not be specified if <Rm> is the SP or PC.
Note
• ARM deprecates the use of the following MOV (register) instructions:
— ones in which <Rd> is the SP or PC and <Rm> is also the SP or PC
— ones in which S is specified and <Rm> is the SP, or <Rm> is the PC.
• See also Changing between Thumb state and ARM state on page A4-158 about the use of the MOV PC, LR
instruction.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[m];
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
// APSR.C unchanged
// APSR.V unchanged
Exceptions
None.
A8-488 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd 0 0 0 0 0 0 0 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-489
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MOV{S}{<c>}{<q>} <Rd>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998. This register can be the SP or PC.
If <Rd> is the PC and S is not specified, the instruction causes a branch to the address moved to the
PC. This is an interworking branch, see Pseudocode details of operations on ARM core registers on
page A2-46.
Note
Before ARMv7, this was a simple branch.
Note
• ARM deprecates the use of the following MOV (register) instructions:
— ones in which <Rd> is the SP or PC and <Rm> is also the SP or PC
— ones in which S is specified and <Rd> is the SP, <Rm> is the SP, or <Rm> is the PC.
• See also Changing between Thumb state and ARM state on page A4-158 about the use of the MOV PC, LR
instruction.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[m];
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
// APSR.C unchanged
// APSR.V unchanged
Exceptions
None.
A8-490 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
Table A8-3 shows the equivalences between MOV (shifted register) and other instructions.
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-491
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.107 MOVT
Move Top writes an immediate value to the top halfword of the destination register. It does not affect the contents
of the bottom halfword.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 1 1 0 0 imm4 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 1 0 0 imm4 Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Assembler syntax
MOVT{<c>}{<q>} <Rd>, #<imm16>
where:
<imm16> The immediate value to be written to <Rd>. It must be in the range 0-65535.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
R[d]<31:16> = imm16;
// R[d]<15:0> unchanged
Exceptions
None.
A8-492 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the opc1, opc2, CRn, and CRm fields. However,
coprocessors CP8-CP15 are reserved for use by ARM, and this manual defines the valid MRC and MRC2 instructions
when coproc is in the range p8-p15. For more information see Coprocessor support on page A2-93 and General
behavior of system control registers on page B5-1768.
In an implementation that includes the Virtualization Extensions, MRC accesses to system control registers can be
trapped to Hyp mode, meaning that an attempt to execute an MRC instruction in a Non-secure mode other than Hyp
mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap exception. For more
information, see Traps to the hypervisor on page B1-1246.
Note
Because of the range of possible traps to Hyp mode, the MRC pseudocode does not show these possible traps.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 opc1 1 CRn Rt coproc opc2 1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 opc1 1 CRn Rt coproc opc2 1 CRm
For the case when cond is 0b1111, see the T2/A2 encoding.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 opc1 1 CRn Rt coproc opc2 1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0 opc1 1 CRn Rt coproc opc2 1 CRm
Advanced SIMD and See 8, 16, and 32-bit transfer between ARM core and extension registers on
Floating-point page A7-276
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-493
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MRC{2}{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <CRn>, <CRm>{, {#}<opc2>}
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM MRC2 instruction must be
unconditional.
<coproc> The name of the coprocessor. The generic coprocessor names are p0-p15.
<Rt> Is the destination ARM core register. This register can be R0-R14 or, in some cases, APSR_nzcv.
The APSR_nzcv form writes bits[31:28] of the transferred value to the N, Z, C, and V condition
flags and is specified by setting the Rt field of the encoding to 0b1111. Some coprocessors do not
support that form of the instruction. For permitted uses with CP14 and CP15, see:
• Additional rules for MCR and MRC accesses to CP14 and CP15 registers on page B3-1444
for a VMSA implementation.
• Additional rules for MCR and MRC accesses to CP14 and CP15 registers on page B5-1769
for a PMSA implementation.
In pre-UAL assembler syntax, PC was written instead of APSR_nzcv to select this form.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
value = Coproc_GetOneWord(cp, ThisInstr());
if t != 15 then
R[t] = value;
else
// Note: not all coprocessors support assignment to the APSR
APSR.N = value<31>;
APSR.Z = value<30>;
APSR.C = value<29>;
APSR.V = value<28>;
// value<27:0> are not used.
Exceptions
Undefined Instruction, Hyp Trap.
A8-494 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the opc1 and CRm fields. However, coprocessors
CP8-CP15 are reserved for use by ARM, and this manual defines the valid MRRC and MRRC2 instructions when coproc
is in the range p8-p15. For more information see Coprocessor support on page A2-93 and General behavior of
system control registers on page B5-1768.
In an implementation that includes the Virtualization Extensions, MRRC accesses to system control registers can be
trapped to Hyp mode, meaning that an attempt to execute an MRRC instruction in a Non-secure mode other than Hyp
mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap exception. For more
information, see Traps to the hypervisor on page B1-1246.
Note
Because of the range of possible traps to Hyp mode, the MRRC pseudocode does not show these possible traps.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 0 1 0 1 Rt2 Rt coproc opc1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 0 1 0 1 Rt2 Rt coproc opc1 CRm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 0 0 1 0 1 Rt2 Rt coproc opc1 CRm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 0 0 1 0 1 Rt2 Rt coproc opc1 CRm
Advanced SIMD and See 64-bit transfers between ARM core and extension registers on page A7-277
Floating-point
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-495
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MRRC{2}{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <Rt2>, <CRm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM MRRC2 instruction must be
unconditional.
<coproc> The name of the coprocessor. The generic coprocessor names are p0-p15.
Note
For the architected uses of the MRRC instructions, as described in this manual, Rt2 transfers bits[63:32] of the
selected coprocessor register, and Rt transfers bits[31:0]. For IMPLEMENTATION DEFINED uses of the instructions the
relative significance of Rt2 and Rt is IMPLEMENTATION DEFINED.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
(R[t2], R[t]) = Coproc_GetTwoWords(cp, ThisInstr());
Exceptions
Undefined Instruction, Hyp Trap.
A8-496 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.110 MRS
Move to Register from Special register moves the value from the APSR into an ARM core register.
For details of system level use of this instruction, see MRS on page B9-1976.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 1 1 0 (1) (1) (1) (1) 1 0 (0) 0 Rd (0) (0) 0 (0) (0) (0) (0) (0)
d = UInt(Rd);
if d IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 0 0 (1) (1) (1) (1) Rd (0) (0) 0 (0) 0 0 0 0 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd);
if d == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-497
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MRS{<c>}{<q>} <Rd>, <spec_reg>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
R[d] = APSR;
Exceptions
None.
A8-498 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For details of system level use of this instruction, see MSR (immediate) on page B9-1982.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 mask 0 0 (1) (1) (1) (1) imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-499
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MSR{<c>}{<q>} <spec_reg>, #<imm>
where:
<imm> Is the immediate value to be transferred to <spec_reg>. See Modified immediate constants in
ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if write_nzcvq then
APSR.N = imm32<31>;
APSR.Z = imm32<30>;
APSR.C = imm32<29>;
APSR.V = imm32<28>;
APSR.Q = imm32<27>;
if write_g then
APSR.GE = imm32<19:16>;
Exceptions
None.
Usage
For details of the APSR see The Application Program Status Register (APSR) on page A2-49. Because of the
Do-Not-Modify nature of its reserved bits, the immediate form of MSR is normally only useful at the Application
level for writing to APSR_nzcvq (CPSR_f).
For the A and R profiles, MSR (immediate) on page B9-1982 describes additional functionality that is available
using the reserved bits. This includes some deprecated functionality that is also available to unprivileged software
and therefore can be used at the Application level.
A8-500 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For details of system level use of this instruction, see MSR (register) on page B9-1984.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 0 0 Rn 1 0 (0) 0 mask 0 0 (0) (0) 0 (0) (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 mask 0 0 (1) (1) (1) (1) (0) (0) 0 (0) 0 0 0 0 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-501
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MSR{<c>}{<q>} <spec_reg>, <Rn>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285.
<spec_reg> Is one of:
• APSR_<bits>
• CPSR_<fields>.
ARM recommends that application level software uses the APSR form. For more information, see The
Application Program Status Register (APSR) on page A2-49.
<Rn> Is the ARM core register to be transferred to <spec_reg>.
<bits> Is one of nzcvq, g, or nzcvqg.
In the A and R profiles:
• APSR_nzcvq is the same as CPSR_f
• APSR_g is the same as CPSR_s
• APSR_nzcvqg is the same as CPSR_fs.
<fields> Is a sequence of one or more of the following: s, f.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if write_nzcvq then
APSR.N = R[n]<31>;
APSR.Z = R[n]<30>;
APSR.C = R[n]<29>;
APSR.V = R[n]<28>;
APSR.Q = R[n]<27>;
if write_g then
APSR.GE = R[n]<19:16>;
Exceptions
None.
Usage
For details of the APSR see The Application Program Status Register (APSR) on page A2-49. Because of the
Do-Not-Modify nature of its reserved bits, a read-modify-write sequence is normally needed when the MSR
instruction is being used at Application level and its destination is not APSR_nzcvq (CPSR_f).
For the A and R profiles, MSR (register) on page B9-1984 describes additional functionality that is available using
the reserved bits. This includes some deprecated functionality that is also available to unprivileged software and
therefore can be used at the Application level.
A8-502 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.115 MUL
Multiply multiplies two register values. The least significant 32 bits of the result are written to the destination
register. These 32 bits do not depend on whether the source register values are considered to be signed values or
unsigned values.
Optionally, it can update the condition flags based on the result. In the Thumb instruction set, this option is limited
to only a few forms of the instruction. Use of this option adversely affects performance on many processor
implementations.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 1 0 1 Rn Rdm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 0 0 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 0 0 S Rd (0) (0) (0) (0) Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-503
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MUL{S}{<c>}{<q>} <Rd>, <Rn>{, <Rm>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
In the Thumb instruction set, S can be specified only if both <Rn> and <Rm> are R0-R7 and the
instruction is outside an IT block.
Note
Issues A and B of this document showed the MUL syntax as MUL{S}{<c>}{<q>} {<Rd>, }<Rn>, <Rm>. The <Rm> register
is now made optional because omitting <Rd> can generate UNPREDICTABLE instructions in some cases. Some
assembler versions might not support this revised specification.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand1 = SInt(R[n]); // operand1 = UInt(R[n]) produces the same final results
operand2 = SInt(R[m]); // operand2 = UInt(R[m]) produces the same final results
result = operand1 * operand2;
R[d] = result<31:0>;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result<31:0>);
if ArchVersion() == 4 then
APSR.C = bit UNKNOWN;
// else APSR.C unchanged
// APSR.V always unchanged
Exceptions
None.
A8-504 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 1 1 S 1 1 1 1 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 1 1 1 S (0) (0) (0) (0) Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); setflags = (S == ‘1’);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-505
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MVN{S}{<c>}{<q>} <Rd>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<const> The immediate value to be bitwise inverted. See Modified immediate constants in Thumb
instructions on page A6-230 or Modified immediate constants in ARM instructions on page A5-197
for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = NOT(imm32);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-506 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 1 1 1 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 1 S 1 1 1 1 (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 1 S (0) (0) (0) (0) Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-507
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MVN{S}{<c>}{<q>} <Rd>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rm> The register that is optionally shifted and used as the source register. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = NOT(shifted);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-508 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 1 S (0) (0) (0) (0) Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-509
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
MVN{S}{<c>}{<q>} <Rd>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = NOT(shifted);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-510 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.119 NEG
Negate is a pre-UAL synonym for RSB (immediate) with an immediate value of 0. For details see RSB (immediate)
on page A8-575.
Assembler syntax
NEG{<c>}{<q>} <Rd>, <Rm>
Exceptions
None.
A8.8.120 NOP
No Operation does nothing. This instruction can be used for instruction alignment purposes.
See Pre-UAL pseudo-instruction NOP on page D8-2460 for details of NOP before the introduction of UAL and the
ARMv6K and ARMv6T2 architecture variants.
Note
The timing effects of including a NOP instruction in a program are not guaranteed. It can increase execution time,
leave it unchanged, or even reduce it. Therefore, NOP instructions are not suitable for timing loops.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 0 0 0 0 0 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 0 0 0
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-511
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
NOP{<c>}{<q>}
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
// Do nothing
Exceptions
None.
A8-512 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 1 1 S Rn 0 imm3 Rd imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-513
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ORN{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<const> The immediate value to be bitwise inverted and ORed with the value obtained from <Rn>. See
Modified immediate constants in Thumb instructions on page A6-230 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] OR NOT(imm32);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-514 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 1 S Rn (0) imm3 Rd imm2 type Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-515
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ORN{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is optionally shifted and used as the second operand.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] OR NOT(shifted);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-516 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 1 0 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 1 0 0 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-517
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ORR{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The register that contains the operand. The PC can be used in ARM instructions, but ARM
deprecates this use of the PC.
<const> The immediate value to be bitwise ORed with the value obtained from <Rn>. See Modified
immediate constants in Thumb instructions on page A6-230 or Modified immediate constants in
ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] OR imm32;
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-518 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 1 0 0 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 0 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
Related encodings See Move register and immediate shifts on page A6-241.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-519
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ORR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
In Thumb assembly:
• outside an IT block, if ORRS <Rd>, <Rn>, <Rd> is written with <Rd> and <Rn> both in the range R0-R7, it is
assembled using encoding T1 as though ORRS <Rd>, <Rn> had been written
• inside an IT block, if ORR<c> <Rd>, <Rn>, <Rd> is written with <Rd> and <Rn> both in the range R0-R7, it is
assembled using encoding T1 as though ORR<c> <Rd>, <Rn> had been written.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] OR shifted;
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-520 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 0 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-521
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ORR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] OR shifted;
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-522 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.126 PKH
Pack Halfword combines one halfword of its first operand with the other halfword of its shifted second operand.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 1 1 0 S Rn (0) imm3 Rd imm2 tb T Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 0 0 Rn Rd imm5 tb 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-523
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PKHBT{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, LSL #<imm>} tbform == FALSE
PKHTB{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, ASR #<imm>} tbform == TRUE
where:
<Rm> The register that is optionally shifted and used as the second operand.
<imm> The shift to apply to the value read from <Rm>, encoded in imm3:imm2 for encoding T1 and imm5
for encoding A1.
For PKHBT, it is one of:
omitted No shift, encoded as 0b00000.
1-31 Left shift by specified number of bits, encoded as a binary number.
For PKHTB, it is one of:
omitted Instruction is a pseudo-instruction and is assembled as though PKHBT{<c>}{<q>} <Rd>,
<Rm>, <Rn> had been written.
1-32 Arithmetic right shift by specified number of bits. A shift by 32 bits is encoded as
0b00000. Other shift amounts are encoded as binary numbers.
Note
An assembler can permit <imm> = 0 to mean the same thing as omitting the shift, but this is not
standard UAL and must not be used for disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = Shift(R[m], shift_t, shift_n, APSR.C); // APSR.C ignored
R[d]<15:0> = if tbform then operand2<15:0> else R[n]<15:0>;
R[d]<31:16> = if tbform then R[n]<31:16> else operand2<31:16>;
Exceptions
None.
A8-524 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
On an architecture variant that includes both the PLD and PLDW instructions, the PLD instruction signals that the likely
memory access is a read, and the PLDW instruction signals that it is a write.
The effect of a PLD or PLDW instruction is IMPLEMENTATION DEFINED. For more information, see Preloading caches
on page A3-155 and Behavior of Preload Data (PLD, PLDW) and Preload Instruction (PLI) with caches on
page B2-1267.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 0 W 1 Rn 1 1 1 1 imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 W 1 Rn 1 1 1 1 1 1 0 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 1 U R 0 1 Rn (1) (1) (1) (1) imm12
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-525
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PLD{W}{<c>}{<q>} [<Rn> {, #+/-<imm>}]
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM PLD or PLDW instruction must be
unconditional.
<Rn> The base register. The SP can be used. For PC use in the PLD instruction, see PLD (literal) on
page A8-527.
+/- Is + or omitted to indicate that the immediate offset is added to the base register value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address. This offset can be omitted, meaning an offset of
0. Values are:
Encoding T1, A1 any value in the range 0-4095
Encoding T2 any value in the range 0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
address = if add then (R[n] + imm32) else (R[n] - imm32);
if is_pldw then
Hint_PreloadDataForWrite(address);
else
Hint_PreloadData(address);
Exceptions
None.
A8-526 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The effect of a PLD instruction is IMPLEMENTATION DEFINED. For more information, see Preloading caches on
page A3-155 and Behavior of Preload Data (PLD, PLDW) and Preload Instruction (PLI) with caches on
page B2-1267.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 U 0 (0) 1 1 1 1 1 1 1 1 1 imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 1 U (1) 0 1 1 1 1 1 (1) (1) (1) (1) imm12
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-527
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PLD{<c>}{<q>} <label> Normal form
PLD{<c>}{<q>} [PC, #+/-<imm>] Alternative form
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM PLD instruction must be
unconditional.
<label> The label of the literal data item that is likely to be accessed in the near future. The assembler
calculates the required value of the offset from the Align(PC, 4) value of the instruction to this label.
The offset must be in the range –4095 to 4095.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE.
+/- Is + or omitted to indicate that the immediate offset is added to the Align(PC, 4) value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address. Values are in the range 0-4095.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
address = if add then (Align(PC,4) + imm32) else (Align(PC,4) - imm32);
Hint_PreloadData(address);
Exceptions
None.
A8-528 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
On an architecture variant that includes both the PLD and PLDW instructions, the PLD instruction signals that the likely
memory access is a read, and the PLDW instruction signals that it is a write.
The effect of a PLD or PLDW instruction is IMPLEMENTATION DEFINED. For more information, see Preloading caches
on page A3-155 and Behavior of Preload Data (PLD, PLDW) and Preload Instruction (PLI) with caches on
page B2-1267.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 W 1 Rn 1 1 1 1 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 1 1 U R 0 1 Rn (1) (1) (1) (1) imm5 type 0 Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-529
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PLD{W}{<c>}{<q>} [<Rn>, +/-<Rm> {, <shift>}]
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM PLD or PLDW instruction must be
unconditional.
<Rn> Is the base register. The SP can be used. The PC can be used in ARM PLD instructions, but not in
Thumb PLD instructions or in any PLDW instructions.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If absent, no shift is applied. For encoding T1, <shift>
can only be omitted, encoded as imm2 = 0b00, or LSL #<imm> with <imm> = 1, 2, or 3, with <imm>
encoded in imm2. For encoding A1, see Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset = Shift(R[m], shift_t, shift_n, APSR.C);
address = if add then (R[n] + offset) else (R[n] - offset);
if is_pldw then
Hint_PreloadDataForWrite(address);
else
Hint_PreloadData(address);
Exceptions
None.
A8-530 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The effect of a PLI instruction is IMPLEMENTATION DEFINED. For more information, see Preloading caches on
page A3-155 and Behavior of Preload Data (PLD, PLDW) and Preload Instruction (PLI) with caches on
page B2-1267.
Encoding T1 ARMv7
PLI<c> [<Rn>, #<imm12>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 0 0 1 Rn 1 1 1 1 imm12
Encoding T2 ARMv7
PLI<c> [<Rn>, #-<imm8>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 0 1 Rn 1 1 1 1 1 1 0 0 imm8
Encoding T3 ARMv7
PLI<c> <label>
PLI<c> [PC, #-0] Special case
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 U 0 0 1 1 1 1 1 1 1 1 1 imm12
Encoding A1 ARMv7
PLI [<Rn>, #+/-<imm12>]
PLI <label>
PLI [PC, #-0] Special case
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 U 1 0 1 Rn (1) (1) (1) (1) imm12
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-531
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PLI{<c>}{<q>} [<Rn> {, #+/-<imm>}] Immediate form
PLI{<c>}{<q>} <label> Normal literal form
PLI{<c>}{<q>} [PC, #+/-<imm>] Alternative literal form
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM PLI instruction must be
unconditional.
+/- Is + or omitted to indicate that the immediate offset is added to the base register value (add == TRUE),
or – to indicate that the offset is to be subtracted (add == FALSE). Different instructions are generated
for #0 and #-0.
<imm> The immediate offset used for forming the address. For the immediate form of the syntax, <imm> can
be omitted, in which case the #0 form of the instruction is assembled. Values are:
Encoding T1, T3, A1 any value in the range 0 to 4095
Encoding T2 any value in the range 0 to 255.
<label> The label of the instruction that is likely to be accessed in the near future. The assembler calculates
the required value of the offset from the Align(PC, 4) value of the instruction to this label. The offset
must be in the range –4095 to 4095.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE.
For the literal forms of the instruction, encoding T3 is used, or Rn is encoded as 0b1111 in encoding A1, to indicate
that the PC is the base register.
The alternative literal syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
base = if n == 15 then Align(PC,4) else R[n];
address = if add then (base + imm32) else (base - imm32);
Hint_PreloadInstr(address);
Exceptions
None.
A8-532 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The effect of a PLI instruction is IMPLEMENTATION DEFINED. For more information, see Preloading caches on
page A3-155 and Behavior of Preload Data (PLD, PLDW) and Preload Instruction (PLI) with caches on
page B2-1267.
Encoding T1 ARMv7
PLI<c> [<Rn>, <Rm>{, LSL #<imm2>}]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 0 0 1 Rn 1 1 1 1 0 0 0 0 0 0 imm2 Rm
Encoding A1 ARMv7
PLI [<Rn>,+/-<Rm>{, <shift>}]
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 1 0 U 1 0 1 Rn (1) (1) (1) (1) imm5 type 0 Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-533
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PLI{<c>}{<q>} [<Rn>, +/-<Rm> {, <shift>}]
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM PLI instruction must be
unconditional.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally shifted and applied to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If absent, no shift is applied. For encoding T1, <shift>
can only be omitted, encoded as imm2 = 0b00, or LSL #<imm> with <imm> = 1, 2, or 3, with <imm>
encoded in imm2. For encoding A1, see Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset = Shift(R[m], shift_t, shift_n, APSR.C);
address = if add then (R[n] + offset) else (R[n] - offset);
Hint_PreloadInstr(address);
Exceptions
None.
A8-534 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 0 P register_list
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 0 1 1 1 1 0 1 P M (0) register_list
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 1 1 1 0 1 Rt 1 0 1 1 0 0 0 0 0 1 0 0
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-535
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
POP{<c>}{<q>} <registers> Standard syntax
LDM{<c>}{<q>} SP!, <registers> Equivalent LDM syntax
where:
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
If the list contains more than one register, the instruction is assembled to encoding T1 or T2. If the
list contains exactly one register, the instruction is assembled to encoding T1 or T3.
The PC can be in the list. If it is, the instruction branches to the address loaded to the PC. In
ARMv5T and above, this is an interworking branch, see Pseudocode details of operations on ARM
core registers on page A2-46. If the PC is in the list:
• the LR must not be in the list
• the instruction must be either outside any IT block, or the last instruction in an IT block.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(13);
address = SP;
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = if UnalignedAllowed then MemU[address,4] else MemA[address,4];
address = address + 4;
if registers<15> == ‘1’ then
if UnalignedAllowed then
if address<1:0> == ‘00’ then
LoadWritePC(MemU[address,4]);
else
UNPREDICTABLE;
else
LoadWritePC(MemA[address,4]);
if registers<13> == ‘0’ then SP = SP + 4*BitCount(registers);
if registers<13> == ‘1’ then SP = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-536 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 0 1 0 1 1 1 1 0 1 register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 0 1 0 0 1 1 1 0 1 Rt 0 0 0 0 0 0 0 0 0 1 0 0
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-537
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
POP{<c>}{<q>} <registers> Standard syntax
LDM{<c>}{<q>} SP!, <registers> Equivalent LDM syntax
where:
<registers> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }. The
lowest-numbered register is loaded from the lowest memory address, through to the
highest-numbered register from the highest memory address. See also Encoding of lists of ARM core
registers on page A8-293.
If the list contains more than one register, the instruction is assembled to encoding A1. If the list
contains exactly one register, the instruction is assembled to encoding A2.
The SP can only be in the list before ARMv7. ARM deprecates any use of ARM instructions that
include the SP, and the value of the SP after such an instruction is UNKNOWN.
The PC can be in the list. If it is, the instruction branches to the address loaded to the PC. In
ARMv5T and above, this is an interworking branch, see Pseudocode details of operations on ARM
core registers on page A2-46.
ARM deprecates the use of this instruction with both the LR and the PC in the list.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(13);
address = SP;
for i = 0 to 14
if registers<i> == ‘1’ then
R[i] = if UnalignedAllowed then MemU[address,4] else MemA[address,4];
address = address + 4;
if registers<15> == ‘1’ then
if UnalignedAllowed then
if address<1:0> == ‘00’ then
LoadWritePC(MemU[address,4]);
else
UNPREDICTABLE;
else
LoadWritePC(MemA[address,4]);
if registers<13> == ‘0’ then SP = SP + 4*BitCount(registers);
if registers<13> == ‘1’ then SP = bits(32) UNKNOWN;
Exceptions
Data Abort.
A8-538 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.134 PUSH
Push Multiple Registers stores multiple registers to the stack, storing to consecutive memory locations ending just
below the address in SP, and updates SP to point to the start of the stored data.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 1 0 M register_list
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 1 0 0 1 0 1 1 0 1 (0) M (0) register_list
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 1 Rt 1 1 0 1 0 0 0 0 0 1 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 1 0 0 1 0 1 1 0 1 register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 1 0 0 1 0 1 1 0 1 Rt 0 0 0 0 0 0 0 0 0 1 0 0
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-539
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
PUSH{<c>}{<q>} <registers> Standard syntax
STMDB{<c>}{<q>} SP!, <registers> Equivalent STM syntax
where:
<registers> Is a list of one or more registers to be stored, separated by commas and surrounded by { and }. The
lowest-numbered register is stored to the lowest memory address, through to the highest-numbered
register to the highest memory address. See also Encoding of lists of ARM core registers on
page A8-293.
If the list contains more than one register, the instruction is assembled to encoding T1, T2, or A1. If
the list contains exactly one register, the instruction is assembled to encoding T1, T3, or A2.
The SP and PC can be in the list in ARM instructions, but not in Thumb instructions. However:
• ARM deprecates the use of ARM instructions that include the PC in the list
• if the SP is in the list, and it is not the lowest-numbered register in the list, the instruction
stores an UNKNOWN value for the SP.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(13);
address = SP - 4*BitCount(registers);
for i = 0 to 14
if registers<i> == ‘1’ then
if i == 13 && i != LowestSetBit(registers) then // Only possible for encoding A1
MemA[address,4] = bits(32) UNKNOWN;
else
if UnalignedAllowed then
MemU[address,4] = R[i];
else
MemA[address,4] = R[i];
address = address + 4;
if registers<15> == ‘1’ then // Only possible for encoding A1 or A2
if UnalignedAllowed then
MemU[address,4] = PCStoreValue();
else
MemA[address,4] = PCStoreValue();
SP = SP - 4*BitCount(registers);
Exceptions
Data Abort.
A8-540 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.135 QADD
Saturating Add adds two register values, saturates the result to the 32-bit signed integer range –231 to (231 – 1), and
writes the result to the destination register. If saturation occurs, it sets the Q flag in the APSR.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 1 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 0 0 Rn Rd (0) (0) (0) (0) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-541
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QADD{<c>}{<q>} {<Rd>,} <Rm>, <Rn>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(R[d], sat) = SignedSatQ(SInt(R[m]) + SInt(R[n]), 32);
if sat then
APSR.Q = ‘1’;
Exceptions
None.
A8-542 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.136 QADD16
Saturating Add 16 performs two 16-bit integer additions, saturates the results to the 16-bit signed integer range
–215 ≤ x ≤ 215 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rn 1 1 1 1 Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 0 Rn Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-543
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<15:0>) + SInt(R[m]<15:0>);
sum2 = SInt(R[n]<31:16>) + SInt(R[m]<31:16>);
R[d]<15:0> = SignedSat(sum1, 16);
R[d]<31:16> = SignedSat(sum2, 16);
Exceptions
None.
A8-544 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.137 QADD8
Saturating Add 8 performs four 8-bit integer additions, saturates the results to the 8-bit signed integer range
–27 ≤ x ≤ 27 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-545
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QADD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<7:0>) + SInt(R[m]<7:0>);
sum2 = SInt(R[n]<15:8>) + SInt(R[m]<15:8>);
sum3 = SInt(R[n]<23:16>) + SInt(R[m]<23:16>);
sum4 = SInt(R[n]<31:24>) + SInt(R[m]<31:24>);
R[d]<7:0> = SignedSat(sum1, 8);
R[d]<15:8> = SignedSat(sum2, 8);
R[d]<23:16> = SignedSat(sum3, 8);
R[d]<31:24> = SignedSat(sum4, 8);
Exceptions
None.
A8-546 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.138 QASX
Saturating Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one
16-bit integer addition and one 16-bit subtraction, saturates the results to the 16-bit signed integer range
–215 ≤ x ≤ 215 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 0 Rn Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-547
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QASX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff = SInt(R[n]<15:0>) - SInt(R[m]<31:16>);
sum = SInt(R[n]<31:16>) + SInt(R[m]<15:0>);
R[d]<15:0> = SignedSat(diff, 16);
R[d]<31:16> = SignedSat(sum, 16);
Exceptions
None.
A8-548 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.139 QDADD
Saturating Double and Add adds a doubled register value to another register value, and writes the result to the
destination register. Both the doubling and the addition have their results saturated to the 32-bit signed integer range
–231 ≤ x ≤ 231 – 1. If saturation occurs in either operation, it sets the Q flag in the APSR.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 1 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 0 0 Rn Rd (0) (0) (0) (0) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-549
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QDADD{<c>}{<q>} {<Rd>,} <Rm>, <Rn>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(doubled, sat1) = SignedSatQ(2 * SInt(R[n]), 32);
(R[d], sat2) = SignedSatQ(SInt(R[m]) + SInt(doubled), 32);
if sat1 || sat2 then
APSR.Q = ‘1’;
Exceptions
None.
A8-550 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.140 QDSUB
Saturating Double and Subtract subtracts a doubled register value from another register value, and writes the result
to the destination register. Both the doubling and the subtraction have their results saturated to the 32-bit signed
integer range –231 ≤ x ≤ 231 – 1. If saturation occurs in either operation, it sets the Q flag in the APSR.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 1 0 1 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 1 0 Rn Rd (0) (0) (0) (0) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-551
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QDSUB{<c>}{<q>} {<Rd>,} <Rm>, <Rn>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(doubled, sat1) = SignedSatQ(2 * SInt(R[n]), 32);
(R[d], sat2) = SignedSatQ(SInt(R[m]) - SInt(doubled), 32);
if sat1 || sat2 then
APSR.Q = ‘1’;
Exceptions
None.
A8-552 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.141 QSAX
Saturating Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs one
16-bit integer subtraction and one 16-bit addition, saturates the results to the 16-bit signed integer range
–215 ≤ x ≤ 215 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 1 0 Rn 1 1 1 1 Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 0 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-553
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QSAX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum = SInt(R[n]<15:0>) + SInt(R[m]<31:16>);
diff = SInt(R[n]<31:16>) - SInt(R[m]<15:0>);
R[d]<15:0> = SignedSat(sum, 16);
R[d]<31:16> = SignedSat(diff, 16);
Exceptions
None.
A8-554 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.142 QSUB
Saturating Subtract subtracts one register value from another register value, saturates the result to the 32-bit signed
integer range –231 ≤ x ≤ 231 – 1, and writes the result to the destination register. If saturation occurs, it sets the Q
flag in the APSR.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 1 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 Rn Rd (0) (0) (0) (0) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-555
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QSUB{<c>}{<q>} {<Rd>,} <Rm>, <Rn>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(R[d], sat) = SignedSatQ(SInt(R[m]) - SInt(R[n]), 32);
if sat then
APSR.Q = ‘1’;
Exceptions
None.
A8-556 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.143 QSUB16
Saturating Subtract 16 performs two 16-bit integer subtractions, saturates the results to the 16-bit signed integer
range –215 ≤ x ≤ 215 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 1 Rn 1 1 1 1 Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 0 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-557
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QSUB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<15:0>) - SInt(R[m]<15:0>);
diff2 = SInt(R[n]<31:16>) - SInt(R[m]<31:16>);
R[d]<15:0> = SignedSat(diff1, 16);
R[d]<31:16> = SignedSat(diff2, 16);
Exceptions
None.
A8-558 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.144 QSUB8
Saturating Subtract 8 performs four 8-bit integer subtractions, saturates the results to the 8-bit signed integer range
–27 ≤ x ≤ 27 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 0 Rn 1 1 1 1 Rd 0 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 0 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-559
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
QSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<7:0>) - SInt(R[m]<7:0>);
diff2 = SInt(R[n]<15:8>) - SInt(R[m]<15:8>);
diff3 = SInt(R[n]<23:16>) - SInt(R[m]<23:16>);
diff4 = SInt(R[n]<31:24>) - SInt(R[m]<31:24>);
R[d]<7:0> = SignedSat(diff1, 8);
R[d]<15:8> = SignedSat(diff2, 8);
R[d]<23:16> = SignedSat(diff3, 8);
R[d]<31:24> = SignedSat(diff4, 8);
Exceptions
None.
A8-560 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.145 RBIT
Reverse Bits reverses the bit order in a 32-bit register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rm 1 1 1 1 Rd 1 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); m = UInt(Rm);
if d == 15 || m == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-561
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RBIT{<c>}{<q>} <Rd>, <Rm>
where:
<Rm> The register that contains the operand. In encoding T1, its number must be encoded twice.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
bits(32) result;
for i = 0 to 31
result<31-i> = R[m]<i>;
R[d] = result;
Exceptions
None.
A8-562 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.146 REV
Byte-Reverse Word reverses the byte order in a 32-bit register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 0 1 0 0 0 Rm Rd
d = UInt(Rd); m = UInt(Rm);
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rm 1 1 1 1 Rd 1 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); m = UInt(Rm);
if d == 15 || m == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-563
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
REV{<c>}{<q>} <Rd>, <Rm>
where:
<Rm> The register that contains the operand. Its number must be encoded twice in encoding T2.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
bits(32) result;
result<31:24> = R[m]<7:0>;
result<23:16> = R[m]<15:8>;
result<15:8> = R[m]<23:16>;
result<7:0> = R[m]<31:24>;
R[d] = result;
Exceptions
None.
A8-564 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.147 REV16
Byte-Reverse Packed Halfword reverses the byte order in each16-bit halfword of a 32-bit register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 0 1 0 0 1 Rm Rd
d = UInt(Rd); m = UInt(Rm);
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rm 1 1 1 1 Rd 1 0 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); m = UInt(Rm);
if d == 15 || m == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-565
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
REV16{<c>}{<q>} <Rd>, <Rm>
where:
<Rm> The register that contains the operand. Its number must be encoded twice in encoding T2.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
bits(32) result;
result<31:24> = R[m]<23:16>;
result<23:16> = R[m]<31:24>;
result<15:8> = R[m]<7:0>;
result<7:0> = R[m]<15:8>;
R[d] = result;
Exceptions
None.
A8-566 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.148 REVSH
Byte-Reverse Signed Halfword reverses the byte order in the lower 16-bit halfword of a 32-bit register, and
sign-extends the result to 32 bits.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 0 1 0 1 1 Rm Rd
d = UInt(Rd); m = UInt(Rm);
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rm 1 1 1 1 Rd 1 0 1 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 1 (1) (1) (1) (1) Rd (1) (1) (1) (1) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); m = UInt(Rm);
if d == 15 || m == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-567
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
REVSH{<c>}{<q>} <Rd>, <Rm>
where:
<Rm> The register that contains the operand. Its number must be encoded twice in encoding T2.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
bits(32) result;
result<31:8> = SignExtend(R[m]<7:0>, 24);
result<7:0> = R[m]<15:8>;
R[d] = result;
Exceptions
None.
A8-568 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.149 RFE
Return From Exception is a system instruction. For details see RFE on page B9-1986.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S 1 1 1 1 (0) imm3 Rd imm2 1 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd imm5 1 1 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
if imm5 == ‘00000’ then SEE RRX;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(-, shift_n) = DecodeImmShift(‘11’, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-569
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ROR{S}{<c>}{<q>} {<Rd>,} <Rm>, #<imm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
Note
Before ARMv7, this was a simple branch.
<Rm> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<imm> The shift amount, in the range 1 to 31. See Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry) = Shift_C(R[m], SRType_ROR, shift_n, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-570 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 1 1 1 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 1 1 S Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd Rm 0 1 1 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-571
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
ROR{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register whose bottom byte contains the amount to rotate by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[m]<7:0>);
(result, carry) = Shift_C(R[n], SRType_ROR, shift_n, APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-572 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.152 RRX
Rotate Right with Extend provides the value of the contents of a register shifted right by one place, with the Carry
flag shifted into bit[31].
RRX can optionally update the condition flags based on the result. In that case, bit[0] is shifted into the Carry flag.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 1 0 S 1 1 1 1 (0) 0 0 0 Rd 0 0 1 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 S (0) (0) (0) (0) Rd 0 0 0 0 0 1 1 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-573
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RRX{S}{<c>}{<q>} {<Rd>,} <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
Note
Before ARMv7, this was a simple branch.
<Rm> The register that contains the operand. The PC can be used in ARM instructions, but ARM
deprecates this use of the PC.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry) = Shift_C(R[m], SRType_RRX, 1, APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-574 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 0 0 1 Rn Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 1 1 0 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 0 1 1 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’); imm32 = ARMExpandImm(imm12);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-575
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RSB{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<const> The immediate value to be added to the value obtained from <Rn>. The only permitted value for
encoding T1 is 0. See Modified immediate constants in Thumb instructions on page A6-230 or
Modified immediate constants in ARM instructions on page A5-197 for the range of values for
encoding T2 or A1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(NOT(R[n]), imm32, ‘1’);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-576 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 1 1 0 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 1 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-577
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RSB{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(NOT(R[n]), shifted, ‘1’);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-578 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 1 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-579
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RSB{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(NOT(R[n]), shifted, ‘1’);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-580 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 1 1 1 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’); imm32 = ARMExpandImm(imm12);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-581
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RSC{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998.
<Rn> The first operand register. The PC can be used, but ARM deprecates this use of the PC.
<const> The immediate value that the value obtained from <Rn> is to be subtracted from. See Modified
immediate constants in ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(NOT(R[n]), imm32, APSR.C);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-582 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 1 1 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-583
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RSC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used, but ARM deprecates this use of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used, but ARM
deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(NOT(R[n]), shifted, APSR.C);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-584 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 1 1 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-585
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
RSC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(NOT(R[n]), shifted, APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-586 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.159 SADD16
Signed Add 16 performs two 16-bit signed integer additions, and writes the results to the destination register. It sets
the APSR.GE bits according to the results of the additions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-587
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<15:0>) + SInt(R[m]<15:0>);
sum2 = SInt(R[n]<31:16>) + SInt(R[m]<31:16>);
R[d]<15:0> = sum1<15:0>;
R[d]<31:16> = sum2<15:0>;
APSR.GE<1:0> = if sum1 >= 0 then ‘11’ else ‘00’;
APSR.GE<3:2> = if sum2 >= 0 then ‘11’ else ‘00’;
Exceptions
None.
A8-588 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.160 SADD8
Signed Add 8 performs four 8-bit signed integer additions, and writes the results to the destination register. It sets
the APSR.GE bits according to the results of the additions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-589
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SADD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<7:0>) + SInt(R[m]<7:0>);
sum2 = SInt(R[n]<15:8>) + SInt(R[m]<15:8>);
sum3 = SInt(R[n]<23:16>) + SInt(R[m]<23:16>);
sum4 = SInt(R[n]<31:24>) + SInt(R[m]<31:24>);
R[d]<7:0> = sum1<7:0>;
R[d]<15:8> = sum2<7:0>;
R[d]<23:16> = sum3<7:0>;
R[d]<31:24> = sum4<7:0>;
APSR.GE<0> = if sum1 >= 0 then ‘1’ else ‘0’;
APSR.GE<1> = if sum2 >= 0 then ‘1’ else ‘0’;
APSR.GE<2> = if sum3 >= 0 then ‘1’ else ‘0’;
APSR.GE<3> = if sum4 >= 0 then ‘1’ else ‘0’;
Exceptions
None.
A8-590 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.161 SASX
Signed Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one 16-bit
integer addition and one 16-bit subtraction, and writes the results to the destination register. It sets the APSR.GE
bits according to the results.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-591
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SASX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff = SInt(R[n]<15:0>) - SInt(R[m]<31:16>);
sum = SInt(R[n]<31:16>) + SInt(R[m]<15:0>);
R[d]<15:0> = diff<15:0>;
R[d]<31:16> = sum<15:0>;
APSR.GE<1:0> = if diff >= 0 then ‘11’ else ‘00’;
APSR.GE<3:2> = if sum >= 0 then ‘11’ else ‘00’;
Exceptions
None.
A8-592 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 0 1 1 S Rn 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 1 1 0 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); setflags = (S == ‘1’); imm32 = ARMExpandImm(imm12);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-593
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SBC{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<const> The immediate value to be subtracted from the value obtained from <Rn>. See Modified immediate
constants in Thumb instructions on page A6-230 or Modified immediate constants in ARM
instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], NOT(imm32), APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-594 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 1 1 0 Rm Rdn
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 0 1 1 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 1 0 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-595
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SBC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46. ARM deprecates this use of the PC.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], NOT(shifted), APSR.C);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-596 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 1 0 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-597
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SBC{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], NOT(shifted), APSR.C);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-598 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.165 SBFX
Signed Bit Field Extract extracts any number of adjacent bits at any position from a register, sign-extends them to
32 bits, and writes the result to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 0 1 0 0 Rn 0 imm3 Rd imm2 (0) widthm1
d = UInt(Rd); n = UInt(Rn);
lsbit = UInt(imm3:imm2); widthminus1 = UInt(widthm1);
if d IN {13,15} || n IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 1 0 1 widthm1 Rd lsb 1 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); n = UInt(Rn);
lsbit = UInt(lsb); widthminus1 = UInt(widthm1);
if d == 15 || n == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-599
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SBFX{<c>}{<q>} <Rd>, <Rn>, #<lsb>, #<width>
where:
<lsb> is the bit number of the least significant bit in the field, in the range 0-31. This determines the
required value of lsbit.
<width> is the width of the field, in the range 1 to 32-<lsb>. The required value of widthminus1 is <width>-1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
msbit = lsbit + widthminus1;
if msbit <= 31 then
R[d] = SignExtend(R[n]<msbit:lsbit>, 32);
else
UNPREDICTABLE;
Exceptions
None.
A8-600 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.166 SDIV
Signed Divide divides a 32-bit signed integer register value by a 32-bit signed integer register value, and writes the
result to the destination register. The condition flags are not affected.
See ARMv7 implementation requirements and options for the divide instructions on page A4-170 for more
information about this instruction.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 0 0 1 Rn (1) (1) (1) (1) Rd 1 1 1 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 0 0 1 Rd (1) (1) (1) (1) Rm 0 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-601
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SDIV{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if SInt(R[m]) == 0 then
if IntegerZeroDivideTrappingEnabled() then
GenerateIntegerZeroDivide();
else
result = 0;
else
result = RoundTowardsZero(SInt(R[n]) / SInt(R[m]));
R[d] = result<31:0>;
Exceptions
In ARMv7-R profile, Undefined Instruction, see Divide instructions on page A4-170.
Overflow
If the signed integer division 0x80000000 / 0xFFFFFFFF is performed, the pseudocode produces the intermediate
integer result +231, that overflows the 32-bit signed integer range. No indication of this overflow case is produced,
and the 32-bit result written to R[d] must be the bottom 32 bits of the binary representation of +231. So the result of
the division is 0x80000000.
A8-602 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.167 SEL
Select Bytes selects each byte of its result from either its first operand or its second operand, according to the values
of the GE flags.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 1 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 0 0 Rn Rd (1) (1) (1) (1) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-603
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SEL{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
R[d]<7:0> = if APSR.GE<0> == ‘1’ then R[n]<7:0> else R[m]<7:0>;
R[d]<15:8> = if APSR.GE<1> == ‘1’ then R[n]<15:8> else R[m]<15:8>;
R[d]<23:16> = if APSR.GE<2> == ‘1’ then R[n]<23:16> else R[m]<23:16>;
R[d]<31:24> = if APSR.GE<3> == ‘1’ then R[n]<31:24> else R[m]<31:24>;
Exceptions
None.
A8-604 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.168 SETEND
Set Endianness writes a new value to ENDIANSTATE.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 1 1 0 0 1 0 (1) E (0) (0) (0)
set_bigend = (E == ‘1’);
if InITBlock() then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 0 1 0 0 0 0 (0) (0) (0) 1 (0) (0) (0) (0) (0) (0) E (0) 0 0 0 0 (0) (0) (0) (0)
set_bigend = (E == ‘1’);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-605
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SETEND{<q>} <endian_specifier>
where:
<q> See Standard assembler syntax fields on page A8-285. A SETEND instruction must be unconditional.
<endian_specifier>
Is one of:
BE Sets the E bit in the instruction. This sets ENDIANSTATE.
LE Clears the E bit in the instruction. This clears ENDIANSTATE.
Operation
EncodingSpecificOperations();
ENDIANSTATE = if set_bigend then ‘1’ else ‘0’;
Exceptions
None.
A8-606 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.169 SEV
Send Event is a hint instruction. It causes an event to be signaled to all processors in the multiprocessor system. For
more information, see Wait For Event and Send Event on page B1-1199.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 0 0 0 0 0 1 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 1 0 0
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-607
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SEV{<c>}{<q>}
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
SendEvent();
Exceptions
None.
A8-608 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.170 SHADD16
Signed Halving Add 16 performs two signed 16-bit integer additions, halves the results, and writes the results to the
destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rn 1 1 1 1 Rd 0 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 1 Rn Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-609
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SHADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<15:0>) + SInt(R[m]<15:0>);
sum2 = SInt(R[n]<31:16>) + SInt(R[m]<31:16>);
R[d]<15:0> = sum1<16:1>;
R[d]<31:16> = sum2<16:1>;
Exceptions
None.
A8-610 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.171 SHADD8
Signed Halving Add 8 performs four signed 8-bit integer additions, halves the results, and writes the results to the
destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 0 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 1 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-611
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SHADD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<7:0>) + SInt(R[m]<7:0>);
sum2 = SInt(R[n]<15:8>) + SInt(R[m]<15:8>);
sum3 = SInt(R[n]<23:16>) + SInt(R[m]<23:16>);
sum4 = SInt(R[n]<31:24>) + SInt(R[m]<31:24>);
R[d]<7:0> = sum1<8:1>;
R[d]<15:8> = sum2<8:1>;
R[d]<23:16> = sum3<8:1>;
R[d]<31:24> = sum4<8:1>;
Exceptions
None.
A8-612 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.172 SHASX
Signed Halving Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one
signed 16-bit integer addition and one signed 16-bit subtraction, halves the results, and writes the results to the
destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 0 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 1 Rn Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-613
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SHASX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff = SInt(R[n]<15:0>) - SInt(R[m]<31:16>);
sum = SInt(R[n]<31:16>) + SInt(R[m]<15:0>);
R[d]<15:0> = diff<16:1>;
R[d]<31:16> = sum<16:1>;
Exceptions
None.
A8-614 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.173 SHSAX
Signed Halving Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs one
signed 16-bit integer subtraction and one signed 16-bit addition, halves the results, and writes the results to the
destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 1 0 Rn 1 1 1 1 Rd 0 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-615
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SHSAX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum = SInt(R[n]<15:0>) + SInt(R[m]<31:16>);
diff = SInt(R[n]<31:16>) - SInt(R[m]<15:0>);
R[d]<15:0> = sum<16:1>;
R[d]<31:16> = diff<16:1>;
Exceptions
None.
A8-616 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.174 SHSUB16
Signed Halving Subtract 16 performs two signed 16-bit integer subtractions, halves the results, and writes the results
to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 1 Rn 1 1 1 1 Rd 0 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-617
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SHSUB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<15:0>) - SInt(R[m]<15:0>);
diff2 = SInt(R[n]<31:16>) - SInt(R[m]<31:16>);
R[d]<15:0> = diff1<16:1>;
R[d]<31:16> = diff2<16:1>;
Exceptions
None.
A8-618 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.175 SHSUB8
Signed Halving Subtract 8 performs four signed 8-bit integer subtractions, halves the results, and writes the results
to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 0 Rn 1 1 1 1 Rd 0 0 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 1 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-619
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SHSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<7:0>) - SInt(R[m]<7:0>);
diff2 = SInt(R[n]<15:8>) - SInt(R[m]<15:8>);
diff3 = SInt(R[n]<23:16>) - SInt(R[m]<23:16>);
diff4 = SInt(R[n]<31:24>) - SInt(R[m]<31:24>);
R[d]<7:0> = diff1<8:1>;
R[d]<15:8> = diff2<8:1>;
R[d]<23:16> = diff3<8:1>;
R[d]<31:24> = diff4<8:1>;
Exceptions
None.
A8-620 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
If overflow occurs during the addition of the accumulate value, the instruction sets the Q flag in the APSR. It is not
possible for overflow to occur during the multiplication.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 0 1 Rn Ra Rd 0 0 N M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 0 0 Rd Ra Rm 1 M N 0 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-621
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLA<x><y>{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
<x> Specifies which half of the source register <Rn> is used as the first multiply operand. If <x> is B, then
the bottom half (bits[15:0]) of <Rn> is used. If <x> is T, then the top half (bits[31:16]) of <Rn> is used.
<y> Specifies which half of the source register <Rm> is used as the second multiply operand. If <y> is B,
then the bottom half (bits[15:0]) of <Rm> is used. If <y> is T, then the top half (bits[31:16]) of <Rm> is
used.
<Rn> The source register whose bottom or top half (selected by <x>) is the first multiply operand.
<Rm> The source register whose bottom or top half (selected by <y>) is the second multiply operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand1 = if n_high then R[n]<31:16> else R[n]<15:0>;
operand2 = if m_high then R[m]<31:16> else R[m]<15:0>;
result = SInt(operand1) * SInt(operand2) + SInt(R[a]);
R[d] = result<31:0>;
if result != SInt(result<31:0>) then // Signed overflow
APSR.Q = ‘1’;
Exceptions
None.
A8-622 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.178 SMLAD
Signed Multiply Accumulate Dual performs two signed 16 × 16-bit multiplications. It adds the products to a 32-bit
accumulate operand.
Optionally, the instruction can exchange the halfwords of the second operand before performing the arithmetic. This
produces top × bottom and bottom × top multiplication.
This instruction sets the Q flag if the accumulate operation overflows. Overflow cannot occur during the
multiplications.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 1 0 Rn Ra Rd 0 0 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 0 0 0 Rd Ra Rm 0 0 M 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-623
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLAD{X}{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
X If X is present (encoded as M = 1), the multiplications are bottom × top and top × bottom.
If the X is omitted (encoded as M = 0), the multiplications are bottom × bottom and top × top.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_swap then ROR(R[m],16) else R[m];
product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
result = product1 + product2 + SInt(R[a]);
R[d] = result<31:0>;
if result != SInt(result<31:0>) then // Signed overflow
APSR.Q = ‘1’;
Exceptions
None.
A8-624 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.179 SMLAL
Signed Multiply Accumulate Long multiplies two signed 32-bit values to produce a 64-bit value, and accumulates
this with a 64-bit value.
In ARM instructions, the condition flags can optionally be updated based on the result. Use of this option adversely
affects performance on many processor implementations.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 1 0 0 Rn RdLo RdHi 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 1 1 S RdHi RdLo Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-625
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLAL{S}{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
S can be specified only for the ARM instruction set.
<RdLo> Supplies the lower 32 bits of the accumulate value, and is the destination register for the lower 32
bits of the result.
<RdHi> Supplies the upper 32 bits of the accumulate value, and is the destination register for the upper 32
bits of the result.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = SInt(R[n]) * SInt(R[m]) + SInt(R[dHi]:R[dLo]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
if setflags then
APSR.N = result<63>;
APSR.Z = IsZeroBit(result<63:0>);
if ArchVersion() == 4 then
APSR.C = bit UNKNOWN;
APSR.V = bit UNKNOWN;
// else APSR.C, APSR.V unchanged
Exceptions
None.
A8-626 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Overflow is possible during this instruction, but only as a result of the 64-bit addition. This overflow is not detected
if it occurs. Instead, the result wraps around modulo 264.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 1 0 0 Rn RdLo RdHi 1 0 N M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 0 0 RdHi RdLo Rm 1 M N 0 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-627
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLAL<x><y>{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
<x> Specifies which half of the source register <Rn> is used as the first multiply operand. If <x> is B, then
the bottom half (bits[15:0]) of <Rn> is used. If <x> is T, then the top half (bits[31:16]) of <Rn> is used.
<y> Specifies which half of the source register <Rm> is used as the second multiply operand. If <y> is B,
then the bottom half (bits[15:0]) of <Rm> is used. If <y> is T, then the top half (bits[31:16]) of <Rm> is
used.
<RdLo> Supplies the lower 32 bits of the accumulate value, and is the destination register for the lower 32
bits of the result.
<RdHi> Supplies the upper 32 bits of the accumulate value, and is the destination register for the upper 32
bits of the result.
<Rn> The source register whose bottom or top half (selected by <x>) is the first multiply operand.
<Rm> The source register whose bottom or top half (selected by <y>) is the second multiply operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand1 = if n_high then R[n]<31:16> else R[n]<15:0>;
operand2 = if m_high then R[m]<31:16> else R[m]<15:0>;
result = SInt(operand1) * SInt(operand2) + SInt(R[dHi]:R[dLo]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
Exceptions
None.
A8-628 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.181 SMLALD
Signed Multiply Accumulate Long Dual performs two signed 16 × 16-bit multiplications. It adds the products to a
64-bit accumulate operand.
Optionally, the instruction can exchange the halfwords of the second operand before performing the arithmetic. This
produces top × bottom and bottom × top multiplication.
Overflow is possible during this instruction, but only as a result of the 64-bit addition. This overflow is not detected
if it occurs. Instead, the result wraps around modulo 264.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 1 0 0 Rn RdLo RdHi 1 1 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 1 0 0 RdHi RdLo Rm 0 0 M 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-629
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLALD{X}{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
<RdLo> Supplies the lower 32 bits of the accumulate value, and is the destination register for the lower 32
bits of the result.
<RdHi> Supplies the upper 32 bits of the accumulate value, and is the destination register for the upper 32
bits of the result.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_swap then ROR(R[m],16) else R[m];
product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
result = product1 + product2 + SInt(R[dHi]:R[dLo]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
Exceptions
None.
A8-630 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
If overflow occurs during the addition of the accumulate value, the instruction sets the Q flag in the APSR. No
overflow can occur during the multiplication.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 1 1 Rn Ra Rd 0 0 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 Rd Ra Rm 1 M 0 0 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-631
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLAW<y>{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
<y> Specifies which half of the source register <Rm> is used as the second multiply operand. If <y> is B,
then the bottom half (bits[15:0]) of <Rm> is used. If <y> is T, then the top half (bits[31:16]) of <Rm> is
used.
<Rm> The source register whose bottom or top half (selected by <y>) is the second multiply operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_high then R[m]<31:16> else R[m]<15:0>;
result = SInt(R[n]) * SInt(operand2) + (SInt(R[a]) << 16);
R[d] = result<47:16>;
if (result >> 16) != SInt(R[d]) then // Signed overflow
APSR.Q = ‘1’;
Exceptions
None.
A8-632 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.183 SMLSD
Signed Multiply Subtract Dual performs two signed 16 × 16-bit multiplications. It adds the difference of the
products to a 32-bit accumulate operand.
Optionally, the instruction can exchange the halfwords of the second operand before performing the arithmetic. This
produces top × bottom and bottom × top multiplication.
This instruction sets the Q flag if the accumulate operation overflows. Overflow cannot occur during the
multiplications or subtraction.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 0 0 Rn Ra Rd 0 0 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 0 0 0 Rd Ra Rm 0 1 M 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-633
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLSD{X}{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_swap then ROR(R[m],16) else R[m];
product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
result = product1 - product2 + SInt(R[a]);
R[d] = result<31:0>;
if result != SInt(result<31:0>) then // Signed overflow
APSR.Q = ‘1’;
Exceptions
None.
A8-634 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.184 SMLSLD
Signed Multiply Subtract Long Dual performs two signed 16 × 16-bit multiplications. It adds the difference of the
products to a 64-bit accumulate operand.
Optionally, the instruction can exchange the halfwords of the second operand before performing the arithmetic. This
produces top × bottom and bottom × top multiplication.
Overflow is possible during this instruction, but only as a result of the 64-bit addition. This overflow is not detected
if it occurs. Instead, the result wraps around modulo 264.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 1 0 1 Rn RdLo RdHi 1 1 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 1 0 0 RdHi RdLo Rm 0 1 M 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-635
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMLSLD{X}{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
<RdLo> Supplies the lower 32 bits of the accumulate value, and is the destination register for the lower 32
bits of the result.
<RdHi> Supplies the upper 32 bits of the accumulate value, and is the destination register for the upper 32
bits of the result.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_swap then ROR(R[m],16) else R[m];
product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
result = product1 - product2 + SInt(R[dHi]:R[dLo]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
Exceptions
None.
A8-636 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.185 SMMLA
Signed Most Significant Word Multiply Accumulate multiplies two signed 32-bit values, extracts the most
significant 32 bits of the result, and adds an accumulate value.
Optionally, the instruction can specify that the result is rounded instead of being truncated. In this case, the constant
0x80000000 is added to the product before the high word is extracted.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 0 1 Rn Ra Rd 0 0 0 R Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 1 0 1 Rd Ra Rm 0 0 R 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-637
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMMLA{R}{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = (SInt(R[a]) << 32) + SInt(R[n]) * SInt(R[m]);
if round then result = result + 0x80000000;
R[d] = result<63:32>;
Exceptions
None.
A8-638 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.186 SMMLS
Signed Most Significant Word Multiply Subtract multiplies two signed 32-bit values, subtracts the result from a
32-bit accumulate value that is shifted left by 32 bits, and extracts the most significant 32 bits of the result of that
subtraction.
Optionally, the instruction can specify that the result of the instruction is rounded instead of being truncated. In this
case, the constant 0x80000000 is added to the result of the subtraction before the high word is extracted.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 1 0 Rn Ra Rd 0 0 0 R Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 1 0 1 Rd Ra Rm 1 1 R 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-639
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMMLS{R}{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = (SInt(R[a]) << 32) - SInt(R[n]) * SInt(R[m]);
if round then result = result + 0x80000000;
R[d] = result<63:32>;
Exceptions
None.
A8-640 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.187 SMMUL
Signed Most Significant Word Multiply multiplies two signed 32-bit values, extracts the most significant 32 bits of
the result, and writes those bits to the destination register.
Optionally, the instruction can specify that the result is rounded instead of being truncated. In this case, the constant
0x80000000 is added to the product before the high word is extracted.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 0 1 Rn 1 1 1 1 Rd 0 0 0 R Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 1 0 1 Rd 1 1 1 1 Rm 0 0 R 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-641
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMMUL{R}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = SInt(R[n]) * SInt(R[m]);
if round then result = result + 0x80000000;
R[d] = result<63:32>;
Exceptions
None.
A8-642 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.188 SMUAD
Signed Dual Multiply Add performs two signed 16 × 16-bit multiplications. It adds the products together, and writes
the result to the destination register.
Optionally, the instruction can exchange the halfwords of the second operand before performing the arithmetic. This
produces top × bottom and bottom × top multiplication.
This instruction sets the Q flag if the addition overflows. The multiplications cannot overflow.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 1 0 Rn 1 1 1 1 Rd 0 0 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 0 0 0 Rd 1 1 1 1 Rm 0 0 M 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-643
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMUAD{X}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_swap then ROR(R[m],16) else R[m];
product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
result = product1 + product2;
R[d] = result<31:0>;
if result != SInt(result<31:0>) then // Signed overflow
APSR.Q = ‘1’;
Exceptions
None.
A8-644 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 0 1 Rn 1 1 1 1 Rd 0 0 N M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 1 1 0 Rd (0) (0) (0) (0) Rm 1 M N 0 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-645
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMUL<x><y>{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
<x> Specifies which half of the source register <Rn> is used as the first multiply operand. If <x> is B, then
the bottom half (bits[15:0]) of <Rn> is used. If <x> is T, then the top half (bits[31:16]) of <Rn> is used.
<y> Specifies which half of the source register <Rm> is used as the second multiply operand. If <y> is B,
then the bottom half (bits[15:0]) of <Rm> is used. If <y> is T, then the top half (bits[31:16]) of <Rm> is
used.
<Rn> The source register whose bottom or top half (selected by <x>) is the first multiply operand.
<Rm> The source register whose bottom or top half (selected by <y>) is the second multiply operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand1 = if n_high then R[n]<31:16> else R[n]<15:0>;
operand2 = if m_high then R[m]<31:16> else R[m]<15:0>;
result = SInt(operand1) * SInt(operand2);
R[d] = result<31:0>;
// Signed overflow cannot occur
Exceptions
None.
A8-646 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.190 SMULL
Signed Multiply Long multiplies two 32-bit signed values to produce a 64-bit result.
In ARM instructions, the condition flags can optionally be updated based on the result. Use of this option adversely
affects performance on many processor implementations.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 0 0 0 Rn RdLo RdHi 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 1 0 S RdHi RdLo Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-647
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMULL{S}{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
S can be specified only for the ARM instruction set.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = SInt(R[n]) * SInt(R[m]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
if setflags then
APSR.N = result<63>;
APSR.Z = IsZeroBit(result<63:0>);
if ArchVersion() == 4 then
APSR.C = bit UNKNOWN;
APSR.V = bit UNKNOWN;
// else APSR.C, APSR.V unchanged
Exceptions
None.
A8-648 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 1 1 Rn 1 1 1 1 Rd 0 0 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 0 Rd (0) (0) (0) (0) Rm 1 M 1 0 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-649
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMULW<y>{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
<y> Specifies which half of the source register <Rm> is used as the second multiply operand. If <y> is B,
then the bottom half (bits[15:0]) of <Rm> is used. If <y> is T, then the top half (bits[31:16]) of <Rm> is
used.
<Rm> The source register whose bottom or top half (selected by <y>) is the second multiply operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_high then R[m]<31:16> else R[m]<15:0>;
product = SInt(R[n]) * SInt(operand2);
R[d] = product<47:16>;
// Signed overflow cannot occur
Exceptions
None.
A8-650 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.192 SMUSD
Signed Multiply Subtract Dual performs two signed 16 × 16-bit multiplications. It subtracts one of the products from
the other, and writes the result to the destination register.
Optionally, the instruction can exchange the halfwords of the second operand before performing the arithmetic. This
produces top × bottom and bottom × top multiplication.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 0 0 Rn 1 1 1 1 Rd 0 0 0 M Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 0 0 0 Rd 1 1 1 1 Rm 0 1 M 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-651
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SMUSD{X}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand2 = if m_swap then ROR(R[m],16) else R[m];
product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
result = product1 - product2;
R[d] = result<31:0>;
// Signed overflow cannot occur
Exceptions
None.
A8-652 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.193 SRS
Store Return State is a system instruction. For details see SRS (Thumb) on page B9-1990 and SRS (ARM) on
page B9-1992.
A8.8.194 SSAT
Signed Saturate saturates an optionally-shifted signed value to a selectable signed range.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 0 0 sh 0 Rn 0 imm3 Rd imm2 (0) sat_imm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 sat_imm Rd imm5 sh 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-653
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SSAT{<c>}{<q>} <Rd>, #<imm>, <Rn> {, <shift>}
where:
<imm> The bit position for saturation, in the range 1 to 32. The sat_imm field of the instruction encodes this
bit position, by taking the value (<imm>-1).
<shift> The optional shift, encoded in the sh bit and the immsh field, where immsh is:
• imm3:imm2 for encoding T1
• imm5 for encoding A1.
<shift> must be one of:
omitted No shift. Encoded as sh = 0, immsh = 0b00000.
LSL #<n> Left shift by <n> bits, with <n> in the range 1-31.
Encoded as sh = 0, immsh = <n>.
ASR #<n> Arithmetic right shift by <n> bits, with <n> in the range 1-31.
Encoded as sh = 1, immsh = <n>.
ASR #32 Arithmetic right shift by 32 bits, permitted only for encoding A1.
Encoded as sh = 1, immsh = 0b00000.
Note
An assembler can permit ASR #0 or LSL #0 to mean the same thing as omitting the shift, but this is
not standard UAL and must not be used for disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand = Shift(R[n], shift_t, shift_n, APSR.C); // APSR.C ignored
(result, sat) = SignedSatQ(SInt(operand), saturate_to);
R[d] = SignExtend(result, 32);
if sat then
APSR.Q = ‘1’;
Exceptions
None.
A8-654 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.195 SSAT16
Signed Saturate 16 saturates two signed 16-bit values to a selected signed range.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 0 0 1 0 Rn 0 0 0 0 Rd 0 0 (0) (0) sat_imm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 0 sat_imm Rd (1) (1) (1) (1) 0 0 1 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-655
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SSAT16{<c>}{<q>} <Rd>, #<imm>, <Rn>
where:
<imm> The bit position for saturation, in the range 1 to 16. The sat_imm field of the instruction encodes this
bit position, by taking the value (<imm>-1).
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result1, sat1) = SignedSatQ(SInt(R[n]<15:0>), saturate_to);
(result2, sat2) = SignedSatQ(SInt(R[n]<31:16>), saturate_to);
R[d]<15:0> = SignExtend(result1, 16);
R[d]<31:16> = SignExtend(result2, 16);
if sat1 || sat2 then
APSR.Q = ‘1’;
Exceptions
None.
A8-656 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.196 SSAX
Signed Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs one 16-bit
integer subtraction and one 16-bit addition, and writes the results to the destination register. It sets the APSR.GE
bits according to the results.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 1 0 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-657
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SSAX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum = SInt(R[n]<15:0>) + SInt(R[m]<31:16>);
diff = SInt(R[n]<31:16>) - SInt(R[m]<15:0>);
R[d]<15:0> = sum<15:0>;
R[d]<31:16> = diff<15:0>;
APSR.GE<1:0> = if sum >= 0 then ‘11’ else ‘00’;
APSR.GE<3:2> = if diff >= 0 then ‘11’ else ‘00’;
Exceptions
None.
A8-658 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.197 SSUB16
Signed Subtract 16 performs two 16-bit signed integer subtractions, and writes the results to the destination register.
It sets the APSR.GE bits according to the results of the subtractions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 1 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-659
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SSUB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<15:0>) - SInt(R[m]<15:0>);
diff2 = SInt(R[n]<31:16>) - SInt(R[m]<31:16>);
R[d]<15:0> = diff1<15:0>;
R[d]<31:16> = diff2<15:0>;
APSR.GE<1:0> = if diff1 >= 0 then ‘11’ else ‘00’;
APSR.GE<3:2> = if diff2 >= 0 then ‘11’ else ‘00’;
Exceptions
None.
A8-660 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.198 SSUB8
Signed Subtract 8 performs four 8-bit signed integer subtractions, and writes the results to the destination register.
It sets the APSR.GE bits according to the results of the subtractions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 0 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 0 0 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-661
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = SInt(R[n]<7:0>) - SInt(R[m]<7:0>);
diff2 = SInt(R[n]<15:8>) - SInt(R[m]<15:8>);
diff3 = SInt(R[n]<23:16>) - SInt(R[m]<23:16>);
diff4 = SInt(R[n]<31:24>) - SInt(R[m]<31:24>);
R[d]<7:0> = diff1<7:0>;
R[d]<15:8> = diff2<7:0>;
R[d]<23:16> = diff3<7:0>;
R[d]<31:24> = diff4<7:0>;
APSR.GE<0> = if diff1 >= 0 then ‘1’ else ‘0’;
APSR.GE<1> = if diff2 >= 0 then ‘1’ else ‘0’;
APSR.GE<2> = if diff3 >= 0 then ‘1’ else ‘0’;
APSR.GE<3> = if diff4 >= 0 then ‘1’ else ‘0’;
Exceptions
None.
A8-662 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
This is a generic coprocessor instruction. Some of the fields have no functionality defined by the architecture and
are free for use by the coprocessor instruction set designer. These are the D bit, the CRd field, and in the Unindexed
addressing mode only, the imm8 field. However, coprocessors CP8-CP15 are reserved for use by ARM, and this
manual defines the valid STC and STC2 instructions when coproc is in the range p8-p15. For more information see
Coprocessor support on page A2-93 and General behavior of system control registers on page B5-1768.
In an implementation that includes the Virtualization Extensions, the permitted STC access to a system control
register can be trapped to Hyp mode, meaning that an attempt to execute an STC instruction in a Non-secure mode
other than Hyp mode, that would be permitted in the absence of the Hyp trap controls, generates a Hyp Trap
exception. For more information, see Trapping general CP14 accesses to debug registers on page B1-1258.
Note
For simplicity, the STC pseudocode does not show this possible trap to Hyp mode.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 0 Rn CRd coproc imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 0 Rn CRd coproc imm8
For the case when cond is 0b1111, see the T2/A2 encoding.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 P U D W 0 Rn CRd coproc imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 0 P U D W 0 Rn CRd coproc imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-663
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Advanced SIMD and Floating-point See Extension register load/store instructions on page A7-272
Assembler syntax
STC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>{, #+/-<imm>}] Offset. P = 1, W = 0.
STC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>, #+/-<imm>]! Pre-indexed. P = 1, W = 1.
STC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>], #+/-<imm> Post-indexed. P = 0, W = 1.
STC{2}{L}{<c>}{<q>} <coproc>, <CRd>, [<Rn>], <option> Unindexed. P = 0, W = 0, U = 1.
where:
2 If specified, selects encoding T2/A2. If omitted, selects encoding T1/A1.
L If specified, selects the D == 1 form of the encoding. If omitted, selects the D == 0 form.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM STC2 instruction must be
unconditional.
<coproc> The name of the coprocessor. The generic coprocessor names are p0-p15.
<CRd> The coprocessor source register.
<Rn> The base register. The SP can be used. In the ARM instruction set, for offset and unindexed
addressing only, the PC can be used. However, ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are multiples of 4 in the range 0-1020.
For the offset addressing syntax, <imm> can be omitted, meaning an offset of +0.
<option> A coprocessor option. An integer in the range 0-255 enclosed in { }. Encoded in imm8.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if !Coproc_Accepted(cp, ThisInstr()) then
GenerateCoprocessorException();
else
NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
repeat
MemA[address,4] = Coproc_GetWordToStore(cp, ThisInstr());
address = address + 4;
until Coproc_DoneStoring(cp, ThisInstr());
if wback then R[n] = offset_addr;
Exceptions
Undefined Instruction, Data Abort, Hyp Trap.
A8-664 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For details of related system instructions see STM (User registers) on page B9-1994.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 0 Rn register_list
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 0 W 0 Rn (0) M (0) register_list
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 0 1 0 W 0 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-665
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STM{<c>}{<q>} <Rn>{!}, <registers>
where:
<registers> Is a list of one or more registers to be stored, separated by commas and surrounded by { and }. The
lowest-numbered register is stored to the lowest memory address, through to the highest-numbered
register to the highest memory address. See also Encoding of lists of ARM core registers on
page A8-293.
Encoding T2 does not support a list containing only one register. If an STM instruction with just one
register <Rt> in the list is assembled to Thumb and encoding T1 is not available, it is assembled to
the equivalent STR{<c>}{<q>} <Rt>, [<Rn>]{, #4} instruction.
The SP and PC can be in the list in ARM instructions, but not in Thumb instructions. However,
ARM deprecates the use of ARM instructions that include the SP or the PC in the list.
ARM deprecates the use of instructions with the base register in the list and ! specified. If the base
register is not the lowest-numbered register in the list, such an instruction stores an UNKNOWN value
for the base register.
An instruction with the base register in the list and ! specified cannot use encoding T2.
STMEA and STMIA are pseudo-instructions for STM. STMEA refers to its use for pushing data onto Empty Ascending
stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
for i = 0 to 14
if registers<i> == ‘1’ then
if i == n && wback && i != LowestSetBit(registers) then
MemA[address,4] = bits(32) UNKNOWN; // Only possible for encodings T1 and A1
else
MemA[address,4] = R[i];
address = address + 4;
if registers<15> == ‘1’ then // Only possible for encoding A1
MemA[address,4] = PCStoreValue();
if wback then R[n] = R[n] + 4*BitCount(registers);
Exceptions
Data Abort.
A8-666 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For details of related system instructions see STM (User registers) on page B9-1994.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 0 0 0 W 0 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-667
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STMDA{<c>}{<q>} <Rn>{!}, <registers>
where:
<registers> Is a list of one or more registers to be stored, separated by commas and surrounded by { and }. The
lowest-numbered register is stored to the lowest memory address, through to the highest-numbered
register to the highest memory address. See also Encoding of lists of ARM core registers on
page A8-293.
The SP and PC can be in the list. However, ARM deprecates the use of instructions that include the
SP or the PC in the list.
ARM deprecates the use of instructions with the base register in the list and ! specified. If the base
register is not the lowest-numbered register in the list, such an instruction stores an UNKNOWN value
for the base register.
STMED is s pseudo-instruction for STMDA, referring to its use for pushing data onto Empty Descending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
address = R[n] - 4*BitCount(registers) + 4;
for i = 0 to 14
if registers<i> == ‘1’ then
if i == n && wback && i != LowestSetBit(registers) then
MemA[address,4] = bits(32) UNKNOWN;
else
MemA[address,4] = R[i];
address = address + 4;
if registers<15> == ‘1’ then
MemA[address,4] = PCStoreValue();
if wback then R[n] = R[n] - 4*BitCount(registers);
Exceptions
Data Abort.
A8-668 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For details of related system instructions see STM (User registers) on page B9-1994.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 1 0 0 W 0 Rn (0) M (0) register_list
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 1 0 0 W 0 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-669
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STMDB{<c>}{<q>} <Rn>{!}, <registers>
where:
<Rn> The base register. The SP can be used. If the SP is used, and ! is specified:
• for encoding T1, it is treated as described in PUSH on page A8-539
• for encoding A1, if there is more than one register in the <registers> list, it is treated as
described in PUSH on page A8-539.
<registers> Is a list of one or more registers to be stored, separated by commas and surrounded by { and }. The
lowest-numbered register is stored to the lowest memory address, through to the highest-numbered
register to the highest memory address. See also Encoding of lists of ARM core registers on
page A8-293.
Encoding T1 does not support a list containing only one register. If an STMDB instruction with just
one register <Rt> in the list is assembled to Thumb, it is assembled to the equivalent STR{<c>}{<q>}
<Rt>, [<Rn>, #-4]{!} instruction.
The SP and PC can be in the list in ARM instructions, but not in Thumb instructions. However,
ARM deprecates the use of ARM instructions that include the SP or the PC in the list.
Instructions with the base register in the list and ! specified are only available in the ARM
instruction set, and ARM deprecates the use of such instructions. If the base register is not the
lowest-numbered register in the list, such an instruction stores an UNKNOWN value for the base
register.
STMFD is a pseudo-instruction for STMDB, referring to its use for pushing data onto Full Descending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] - 4*BitCount(registers);
for i = 0 to 14
if registers<i> == ‘1’ then
if i == n && wback && i != LowestSetBit(registers) then
MemA[address,4] = bits(32) UNKNOWN; // Only possible for encoding A1
else
MemA[address,4] = R[i];
address = address + 4;
if registers<15> == ‘1’ then // Only possible for encoding A1
MemA[address,4] = PCStoreValue();
if wback then R[n] = R[n] - 4*BitCount(registers);
Exceptions
Data Abort.
A8-670 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For details of related system instructions see STM (User registers) on page B9-1994.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 0 0 1 1 0 W 0 Rn register_list
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-671
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STMIB{<c>}{<q>} <Rn>{!}, <registers>
where:
<registers> Is a list of one or more registers to be stored, separated by commas and surrounded by { and }. The
lowest-numbered register is stored to the lowest memory address, through to the highest-numbered
register to the highest memory address. See also Encoding of lists of ARM core registers on
page A8-293.
The SP and PC can be in the list. However, ARM deprecates the use of instructions that include the
SP or the PC in the list.
ARM deprecates the use of instructions with the base register in the list and ! specified. If the base
register is not the lowest-numbered register in the list, such an instruction stores an UNKNOWN value
for the base register.
STMFA is a pseudo-instruction for STMIB, referring to its use for pushing data onto Full Ascending stacks.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
address = R[n] + 4;
for i = 0 to 14
if registers<i> == ‘1’ then
if i == n && wback && i != LowestSetBit(registers) then
MemA[address,4] = bits(32) UNKNOWN;
else
MemA[address,4] = R[i];
address = address + 4;
if registers<15> == ‘1’ then
MemA[address,4] = PCStoreValue();
if wback then R[n] = R[n] + 4*BitCount(registers);
Exceptions
Data Abort.
A8-672 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 0 0 imm5 Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 Rt imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 1 0 0 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 0 Rn Rt 1 P U W imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-673
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STR{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STR{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STR{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are:
Encoding T1 multiples of 4 in the range 0-124
Encoding T2 multiples of 4 in the range 0-1020
Encoding T3 any value in the range 0-4095
Encoding T4 any value in the range 0-255.
For the offset addressing syntax, <imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
if UnalignedSupport() || address<1:0> == ‘00’ then
MemU[address,4] = R[t];
else // Can only occur before ARMv7
MemU[address,4] = bits(32) UNKNOWN;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
ThumbEE instruction
ThumbEE has an additional STR (immediate) encoding. For details see STR (immediate) on page A9-1130.
A8-674 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 P U 0 W 0 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-675
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STR{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STR{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STR{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The source register. The SP or the PC can be used. However, ARM deprecates use of the PC.
<Rn> The base register. The SP can be used. For offset addressing only, the PC can be used. However,
ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Any value in the range 0-4095 is permitted. For
the offset addressing syntax, <imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
MemU[address,4] = if t == 15 then PCStoreValue() else R[t];
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-676 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 0 0 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 0 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 P U 0 W 0 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-677
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STR{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, <shift>}] Offset: index==TRUE, wback==FALSE
STR{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, <shift>}]! Pre-indexed: index==TRUE, wback==TRUE
STR{<c>}{<q>} <Rt>, [<Rn>], <Rm>{, <shift>} Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The source register. The SP can be used. In the ARM instruction set, the PC can be used. However,
ARM deprecates use of the PC.
<Rn> The base register. The SP can be used. In the ARM instruction set, for offset addressing only, the
PC can be used. However, ARM deprecates use of the PC.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally shifted and added to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. For encoding T2, <shift> can only be omitted,
encoded as imm2 = 0b00, or LSL #<imm> with <imm> = 1, 2, or 3, and <imm> encoded in imm2. For
encoding A1, see Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
if t == 15 then // Only possible for encoding A1
data = PCStoreValue();
else
data = R[t];
if UnalignedSupport() || address<1:0> == ‘00’ || CurrentInstrSet() == InstrSet_ARM then
MemU[address,4] = data;
else // Can only occur before ARMv7
MemU[address,4] = bits(32) UNKNOWN;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-678 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 imm5 Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 0 0 0 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 0 0 Rn Rt 1 P U W imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-679
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRB{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STRB{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STRB{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are:
Encoding T1 any value in the range 0-31
Encoding T2 any value in the range 0-4095
Encoding T3 any value in the range 0-255.
For the offset addressing syntax, <imm> can be omitted, meaning an offset of 0.
The pre-UAL syntax STR<c>B is equivalent to STRB<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
MemU[address,1] = R[t]<7:0>;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-680 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 P U 1 W 0 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-681
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRB{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STRB{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STRB{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For offset addressing only, the PC can be used. However,
ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are 0-4095. For the offset addressing
syntax, <imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
MemU[address,1] = R[t]<7:0>;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-682 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 1 0 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 0 0 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 P U 1 W 0 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-683
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRB{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, <shift>}] Offset: index==TRUE, wback==FALSE
STRB{<c>}{<q>} <Rt>, [<Rn>, <Rm>{, <shift>}]! Pre-indexed: index==TRUE, wback==TRUE
STRB{<c>}{<q>} <Rt>, [<Rn>], <Rm>{, <shift>} Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. In the ARM instruction set, for offset addressing only, the
PC can be used. However, ARM deprecates use of the PC.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally shifted and added to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. For encoding T2, <shift> can only be omitted,
encoded as imm2 = 0b00, or LSL #<imm> with <imm> = 1, 2, or 3, and <imm> encoded in imm2. For
encoding A1, see Shifts applied to a register on page A8-289.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
MemU[address,1] = R[t]<7:0>;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-684 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.210 STRBT
Store Register Byte Unprivileged stores a byte from a register to memory. For information about memory accesses
see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
STRBT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or an optionally-shifted register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 0 0 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 0 U 1 1 0 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 U 1 1 0 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-685
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRBT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
STRBT{<c>}{<q>} <Rt>, [<Rn>] {, #<imm>} Post-indexed: ARM only
STRBT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> {, <shift>} Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<imm> The immediate offset applied to the value of <Rn>. Values are 0-255 for encoding T1, and 0-4095 for
encoding A1. <imm> can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is optionally shifted and added to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then Shift(R[m], shift_t, shift_n, APSR.C) else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
MemU_unpriv[address,1] = R[t]<7:0>;
if postindex then R[n] = offset_addr;
Exceptions
Data Abort.
A8-686 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 P U 1 W 0 Rn Rt Rt2 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 0 Rn Rt imm4H 1 1 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Related encodings See Load/store dual, load/store exclusive, table branch on page A6-236.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-687
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The first source register. For an ARM instruction, <Rt> must be even-numbered and not R14.
<Rt2> The second source register. For an ARM instruction, <Rt2> must be <R(t+1)>.
<Rn> The base register. The SP can be used. In the ARM instruction set, for offset addressing only, the
PC can be used. However, ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are multiples of 4 in the range 0-1020
for encoding T1, and any value in the range 0-255 for encoding A1. For the offset addressing syntax,
<imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
if HaveLPAE() && address<2:0> == ‘000’ then
bits(64) data;
if BigEndian() then
data<63:32> = R[t];
data<31:0> = R[t2];
else
data<31:0> = R[t];
data<63:32> = R[t2];
MemA[address,8] = data;
else
MemA[address,4] = R[t];
MemA[address+4,4] = R[t2];
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-688 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 0 W 0 Rn Rt (0) (0) (0) (0) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-689
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>, +/-<Rm>] Offset: index==TRUE, wback==FALSE
STRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>, +/-<Rm>]! Pre-indexed: index==TRUE, wback==TRUE
STRD{<c>}{<q>} <Rt>, <Rt2>, [<Rn>], +/-<Rm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rt> The first source register. This register must be even-numbered and not R14.
<Rn> The base register. The SP can be used. For offset addressing only, the PC can be used. However,
ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE).
<Rm> Contains the offset that is added to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + R[m]) else (R[n] - R[m]);
address = if index then offset_addr else R[n];
if HaveLPAE() && address<2:0> == ‘000’ then
bits(64) data;
if BigEndian() then
data<63:32> = R[t];
data<31:0> = R[t2];
else
data<31:0> = R[t];
data<63:32> = R[t2];
MemA[address,8] = data;
else
MemA[address,4] = R[t];
MemA[address+4,4] = R[t2];
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-690 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.213 STREX
Store Register Exclusive calculates an address from a base register value and an immediate offset, stores a word
from a register to memory if the executing processor has exclusive access to the memory addressed, and returns a
status word that indicates whether this store was performed.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 0 1 0 0 Rn Rt Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 0 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-691
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STREX{<c>}{<q>} <Rd>, <Rt>, [<Rn> {, #<imm>}]
where:
<Rd> The destination register for the returned status value. The value returned is:
0 if the operation updates memory
1 if the operation fails to update memory.
<imm> The immediate offset added to the value of <Rn> to form the address. Values are multiples of 4 in the
range 0-1020 for encoding T1, and 0 for encoding A1. <imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + imm32;
if ExclusiveMonitorsPass(address,4) then
MemA[address,4] = R[t];
R[d] = ZeroExtend(‘0’, 32);
else
R[d] = ZeroExtend(‘1’, 32);
Exceptions
Data Abort.
In ARMv7, a non word-aligned memory address causes an Alignment fault Data Abort exception to be generated,
subject to the following rules:
• If ExclusiveMonitorsPass() returns TRUE, the exception is generated.
• Otherwise, it is IMPLEMENTATION DEFINED whether the exception is generated.
If ExclusiveMonitorsPass() returns FALSE and the memory address, if accessed, would generate a synchronous Data
Abort exception, it is IMPLEMENTATION DEFINED whether the exception is generated.
Note
In ARMv6:
• If SCTLR.A and SCTLR.U are both 0, a non word-aligned memory address causes UNPREDICTABLE
behavior.
A8-692 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.214 STREXB
Store Register Exclusive Byte derives an address from a base register value, stores a byte from a register to memory
if the executing processor has exclusive access to the memory addressed, and returns a status word that indicates
whether this store was performed.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
Encoding T1 ARMv7
STREXB<c> <Rd>, <Rt>, [<Rn>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 0 Rn Rt (1) (1) (1) (1) 0 1 0 0 Rd
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 0 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-693
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STREXB{<c>}{<q>} <Rd>, <Rt>, [<Rn>]
where:
<Rd> The destination register for the returned status value. The value returned is:
0 if the operation updates memory
1 if the operation fails to update memory.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
if ExclusiveMonitorsPass(address,1) then
MemA[address,1] = R[t]<7:0>;
R[d] = ZeroExtend(‘0’, 32);
else
R[d] = ZeroExtend(‘1’, 32);
Exceptions
Data Abort.
Aborts
If a synchronous Data Abort exception is generated by the execution of this instruction:
• memory is not updated
• <Rd> is not updated.
If ExclusiveMonitorsPass() returns FALSE and the memory address, if accessed, would generate a synchronous Data
Abort exception, it is IMPLEMENTATION DEFINED whether the exception is generated.
A8-694 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.215 STREXD
Store Register Exclusive Doubleword derives an address from a base register value, stores a 64-bit doubleword from
two registers to memory if the executing processor has exclusive access to the memory addressed, and returns a
status word that indicates whether this store was performed.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
Encoding T1 ARMv7
STREXD<c> <Rd>, <Rt>, <Rt2>, [<Rn>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 0 Rn Rt Rt2 0 1 1 1 Rd
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 0 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-695
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STREXD{<c>}{<q>} <Rd>, <Rt>, <Rt2>, [<Rn>]
where:
<Rd> The destination register for the returned status value. The value returned is:
0 if the operation updates memory
1 if the operation fails to update memory.
<Rd> must not be the same as <Rn>, <Rt>, or <Rt2>.
<Rt> The first source register. For an ARM instruction, <Rt> must be even-numbered and not R14.
<Rt2> The second source register. For an ARM instruction, <Rt2> must be <R(t+1)>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
// For the alignment requirements see “Aborts and alignment”
// Create doubleword to store such that R[t] will be stored at address and R[t2] at address+4.
value = if BigEndian() then R[t]:R[t2] else R[t2]:R[t];
if ExclusiveMonitorsPass(address,8) then
MemA[address,8] = value;
R[d] = ZeroExtend(‘0’, 32);
else
R[d] = ZeroExtend(‘1’, 32);
Exceptions
Data Abort.
In ARMv7, a non doubleword-aligned memory address causes an Alignment fault Data Abort exception to be
generated, subject to the following rules:
• If ExclusiveMonitorsPass() returns TRUE, the exception is generated.
• Otherwise, it is IMPLEMENTATION DEFINED whether the exception is generated.
If ExclusiveMonitorsPass() returns FALSE and the memory address, if accessed, would generate a synchronous Data
Abort exception, it is IMPLEMENTATION DEFINED whether the exception is generated.
Note
In ARMv6K:
• If SCTLR.A and SCTLR.U are both 0, a non doubleword-aligned memory address causes UNPREDICTABLE
behavior.
A8-696 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.216 STREXH
Store Register Exclusive Halfword derives an address from a base register value, stores a halfword from a register
to memory if the executing processor has exclusive access to the memory addressed, and returns a status word that
indicates whether this store was performed.
For more information about support for shared memory see Synchronization and semaphores on page A3-112. For
information about memory accesses see Memory accesses on page A8-292.
Encoding T1 ARMv7
STREXH<c> <Rd>, <Rt>, [<Rn>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 0 Rn Rt (1) (1) (1) (1) 0 1 0 1 Rd
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 1 1 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rt
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-697
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STREXH{<c>}{<q>} <Rd>, <Rt>, [<Rn>]
where:
<Rd> The destination register for the returned status value. The value returned is:
0 if the operation updates memory
1 if the operation fails to update memory.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n];
if ExclusiveMonitorsPass(address,2) then
MemA[address,2] = R[t]<15:0>;
R[d] = ZeroExtend(‘0’, 32);
else
R[d] = ZeroExtend(‘1’, 32);
Exceptions
Data Abort.
In ARMv7, a non halfword-aligned memory address causes an Alignment fault Data Abort exception to be
generated, subject to the following rules:
• If ExclusiveMonitorsPass() returns TRUE, the exception is generated.
• Otherwise, it is IMPLEMENTATION DEFINED whether the exception is generated.
If ExclusiveMonitorsPass() returns FALSE and the memory address, if accessed, would generate a synchronous Data
Abort exception, it is IMPLEMENTATION DEFINED whether the exception is generated.
Note
In ARMv6K:
• If SCTLR.A and SCTLR.U are both 0, a non halfword-aligned memory address causes UNPREDICTABLE
behavior.
A8-698 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 0 imm5 Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 1 0 1 0 Rn Rt imm12
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 1 0 Rn Rt 1 P U W imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-699
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRH{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STRH{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STRH{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are:
Encoding T1 multiples of 2 in the range 0-62
Encoding T2 any value in the range 0-4095
Encoding T3 any value in the range 0-255.
For the offset addressing syntax, <imm> can be omitted, meaning an offset of 0.
The pre-UAL syntax STR<c>H is equivalent to STRH<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
if UnalignedSupport() || address<0> == ‘0’ then
MemU[address,2] = R[t]<15:0>;
else // Can only occur before ARMv7
MemU[address,2] = bits(16) UNKNOWN;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-700 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 1 W 0 Rn Rt imm4H 1 0 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-701
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRH{<c>}{<q>} <Rt>, [<Rn> {, #+/-<imm>}] Offset: index==TRUE, wback==FALSE
STRH{<c>}{<q>} <Rt>, [<Rn>, #+/-<imm>]! Pre-indexed: index==TRUE, wback==TRUE
STRH{<c>}{<q>} <Rt>, [<Rn>], #+/-<imm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. For offset addressing only, the PC can be used. However,
ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are 0-255. For the offset addressing
syntax, <imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
offset_addr = if add then (R[n] + imm32) else (R[n] - imm32);
address = if index then offset_addr else R[n];
if UnalignedSupport() || address<0> == ‘0’ then
MemU[address,2] = R[t]<15:0>;
else // Can only occur before ARMv7
MemU[address,2] = bits(16) UNKNOWN;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-702 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 0 1 Rm Rn Rt
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 1 0 Rn Rt 0 0 0 0 0 0 imm2 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 P U 0 W 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-703
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRH{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>{, LSL #<imm>}] Offset: index==TRUE, wback==FALSE
STRH{<c>}{<q>} <Rt>, [<Rn>, +/-<Rm>]! Pre-indexed: index==TRUE, wback==TRUE
STRH{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: index==FALSE, wback==TRUE
where:
<Rn> The base register. The SP can be used. In the ARM instruction set, for offset addressing only, the
PC can be used. However, ARM deprecates use of the PC.
+/- Is + or omitted if the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<Rm> Contains the offset that is optionally left shifted and added to the value of <Rn> to form the address.
<imm> If present, the size of the left shift to apply to the value from <Rm>, in the range 1-3. Only encoding
T2 is permitted, and <imm> is encoded in imm2.
If absent, no shift is specified and all encodings are permitted. In encoding T2, imm2 is encoded as
0b00.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = Shift(R[m], shift_t, shift_n, APSR.C);
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if index then offset_addr else R[n];
if UnalignedSupport() || address<0> == ‘0’ then
MemU[address,2] = R[t]<15:0>;
else // Can only occur before ARMv7
MemU[address,2] = bits(16) UNKNOWN;
if wback then R[n] = offset_addr;
Exceptions
Data Abort.
A8-704 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.220 STRHT
Store Register Halfword Unprivileged stores a halfword from a register to memory. For information about memory
accesses see Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
STRHT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or a register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 0 1 0 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 1 1 0 Rn Rt imm4H 1 0 1 1 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 U 0 1 0 Rn Rt (0) (0) (0) (0) 1 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-705
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRHT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
STRHT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
STRHT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> Post-indexed: ARM only
where:
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<imm> The immediate offset applied to the value of <Rn>. Any value in the range 0-255 is permitted. <imm>
can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then R[m] else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
if UnalignedSupport() || address<0> == ‘0’ then
MemU_unpriv[address,2] = R[t]<15:0>;
else // Can only occur before ARMv7
MemU_unpriv[address,2] = bits(16) UNKNOWN;
if postindex then R[n] = offset_addr;
Exceptions
Data Abort.
A8-706 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.221 STRT
Store Register Unprivileged stores a word from a register to memory. For information about memory accesses see
Memory accesses on page A8-292.
The memory access is restricted as if the processor were running in User mode. This makes no difference if the
processor is actually running in User mode.
STRT is UNPREDICTABLE in Hyp mode.
The Thumb instruction uses an offset addressing mode, that calculates the address used for the memory access from
a base register value and an immediate offset, and leaves the base register unchanged.
The ARM instruction uses a post-indexed addressing mode, that uses a base register value as the address for the
memory access, and calculates a new address from a base register value and an offset and writes it back to the base
register. The offset can be an immediate value or an optionally-shifted register value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 0 0 1 0 0 Rn Rt 1 1 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 0 0 U 0 1 0 Rn Rt imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 U 0 1 0 Rn Rt imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-707
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
STRT{<c>}{<q>} <Rt>, [<Rn> {, #<imm>}] Offset: Thumb only
STRT{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>} Post-indexed: ARM only
STRT{<c>}{<q>} <Rt>, [<Rn>], +/-<Rm> {, <shift>} Post-indexed: ARM only
where:
<Rt> The source register. In the ARM instruction set, the PC can be used. However, ARM deprecates use
of the PC.
+/- Is + or omitted if <imm> or the optionally shifted value of <Rm> is to be added to the base register value
(add == TRUE), or – if it is to be subtracted (permitted in ARM instructions only, add == FALSE).
<imm> The immediate offset applied to the value of <Rn>. Values are 0-255 for encoding T1, and 0-4095 for
encoding A1. <imm> can be omitted, meaning an offset of 0.
<Rm> Contains the offset that is optionally shifted and added to the value of <Rn> to form the address.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
if CurrentModeIsHyp() then UNPREDICTABLE; // Hyp mode
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
offset = if register_form then Shift(R[m], shift_t, shift_n, APSR.C) else imm32;
offset_addr = if add then (R[n] + offset) else (R[n] - offset);
address = if postindex then R[n] else offset_addr;
if t == 15 then // Only possible for encodings A1 and A2
data = PCStoreValue();
else
data = R[t];
if UnalignedSupport() || address<1:0> == ‘00’ || CurrentInstrSet() == InstrSet_ARM then
MemU_unpriv[address,4] = data;
else // Can only occur before ARMv7
MemU_unpriv[address,4] = bits(32) UNKNOWN;
if postindex then R[n] = offset_addr;
Exceptions
Data Abort.
A8-708 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 1 1 imm3 Rn Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 1 Rdn imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 1 0 1 S Rn 0 imm3 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 1 0 1 0 Rn 0 imm3 Rd imm8
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-709
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SUB{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const> All encodings permitted
SUBW{<c>}{<q>} {<Rd>,} <Rn>, #<const> Only encoding T4 permitted
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996.
<Rn> The first operand register. If the SP is specified for <Rn>, see SUB (SP minus immediate) on
page A8-717. If the PC is specified for <Rn>, see ADR on page A8-320.
<const> The immediate value to be subtracted from the value obtained from <Rn>. The range of values is 0-7
for encoding T1, 0-255 for encoding T2 and 0-4095 for encoding T4. See Modified immediate
constants in Thumb instructions on page A6-230 for the range of values for encoding T3.
When multiple encodings of the same length are available for an instruction, encoding T3 is
preferred to encoding T4. If encoding T4 is required, use the SUBW syntax. Encoding T1 is preferred
to encoding T2 if <Rd> is specified and encoding T2 is preferred to encoding T1 if <Rd> is omitted.
The pre-UAL syntax SUB<c>S is equivalent to SUBS<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], NOT(imm32), ‘1’);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-710 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 0 1 0 S Rn Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-711
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SUB{S}{<c>}{<q>} {<Rd>,} <Rn>, #<const>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR and related
instructions (ARM) on page B9-1998.
If S is not specified and <Rd> is the PC, the instruction is a branch to the address calculated by the
operation. This is an interworking branch, see Pseudocode details of operations on ARM core
registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. If the SP is specified for <Rn>, see SUB (SP minus immediate) on
page A8-717. If the PC is specified for <Rn>, see ADR on page A8-320.
<const> The immediate value to be subtracted from the value obtained from <Rn>. See Modified immediate
constants in ARM instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(R[n], NOT(imm32), ‘1’);
if d == 15 then
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-712 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 0 1 Rm Rn Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 1 0 1 S Rn (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 0 S Rn Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
if Rn == ‘1101’ then SEE SUB (SP minus register);
d = UInt(Rd); n = UInt(Rn); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-713
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SUB{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC. If the SP is specified for <Rn>, see SUB (SP minus register) on page A8-719.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], NOT(shifted), ‘1’);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-714 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 0 S Rn Rd Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-715
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SUB{S}{<c>}{<q>} {<Rd>,} <Rn>, <Rm>, <type> <Rs>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(R[n], NOT(shifted), ‘1’);
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-716 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 0 0 0 1 imm7
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 1 1 0 1 S 1 1 0 1 0 imm3 Rd imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 1 0 1 0 1 0 1 1 0 1 0 imm3 Rd imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 0 0 1 0 S 1 1 0 1 Rd imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); setflags = (S == ‘1’); imm32 = ARMExpandImm(imm12);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-717
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SUB{S}{<c>}{<q>} {<Rd>,} SP, #<const> All encodings permitted
SUBW{<c>}{<q>} {<Rd>,} SP, #<const> Only encoding T3 permitted
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998. If omitted, <Rd>
is SP.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<const> The immediate value to be subtracted from the value obtained from SP. Values are multiples of 4 in
the range 0-508 for encoding T1 and any value in the range 0-4095 for encoding T3. See Modified
immediate constants in Thumb instructions on page A6-230 or Modified immediate constants in
ARM instructions on page A5-197 for the range of values for encodings T2 and A1.
When both 32-bit encodings are available for an instruction, encoding T2 is preferred to encoding
T3 (if encoding T3 is required, use the SUBW syntax).
The pre-UAL syntax SUB<c>S is equivalent to SUBS<c>.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result, carry, overflow) = AddWithCarry(SP, NOT(imm32), ‘1’);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-718 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 1 1 0 1 S 1 1 0 1 (0) imm3 Rd imm2 type Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 0 S 1 1 0 1 Rd imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
if Rd == ‘1111’ && S == ‘1’ then SEE SUBS PC, LR and related instructions;
d = UInt(Rd); m = UInt(Rm); setflags = (S == ‘1’);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-719
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SUB{S}{<c>}{<q>} {<Rd>,} SP, <Rm> {, <shift>}
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
<Rd> The destination register. If S is specified and <Rd> is the PC, see SUBS PC, LR (Thumb) on
page B9-1996 or SUBS PC, LR and related instructions (ARM) on page B9-1998. If omitted, <Rd>
is SP.
In ARM instructions, if S is not specified and <Rd> is the PC, the instruction is a branch to the address
calculated by the operation. This is an interworking branch, see Pseudocode details of operations
on ARM core registers on page A2-46.
Note
Before ARMv7, this was a simple branch.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
In the Thumb instruction set, if <Rd> is SP or omitted, <shift> is only permitted to be omitted, LSL #1,
LSL #2, or LSL #3.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shifted = Shift(R[m], shift_t, shift_n, APSR.C);
(result, carry, overflow) = AddWithCarry(SP, NOT(shifted), ‘1’);
if d == 15 then // Can only occur for ARM encoding
ALUWritePC(result); // setflags is always FALSE here
else
R[d] = result;
if setflags then
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
APSR.V = overflow;
Exceptions
None.
A8-720 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Software can use this instruction as a call to an operating system to provide a service.
In the following cases, the Supervisor Call exception generated by the SVC instruction is taken to Hyp mode:
• If HCR.TGE is set to 1, and the SVC is executed in Non-secure User mode. For more information, see
Supervisor Call exception, when HCR.TGE is set to 1 on page B1-1191
In these cases, the HSR identifies that the exception entry was caused by a Supervisor Call exception, EC value 0x11,
see Use of the HSR on page B3-1421. The immediate field in the HSR:
• if the SVC is unconditional:
— for the Thumb instruction, is the zero-extended value of the imm8 field
— for the ARM instruction, is the least-significant 16 bits the imm24 field
• if the SVC is conditional, is UNKNOWN.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 1 1 1 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 1 imm24
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-721
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SVC{<c>}{<q>} {#}<imm>
where:
<imm> Specifies an immediate constant, 8-bit in Thumb instructions, or 24-bit in ARM instructions.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
CallSupervisor(imm32<15:0>);
Exceptions
Supervisor Call.
A8-722 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For both instructions, the memory system ensures that no other memory access can occur to the memory location
between the load access and the store access.
Note
• The SWP and SWPB instructions rely on the properties of the system beyond the processor to ensure that no
stores from other observers can occur between the load access and the store access, and this might not be
implemented for all regions of memory on some system implementations. In all cases, SWP and SWPB do ensure
that no stores from the processor that executed the SWP or SWPB instruction can occur between the load access
and the store access of the SWP or SWPB.
• ARM deprecates the use of SWP and SWPB, and strongly recommends that new software uses:
— LDREX/STREX in preference to SWP
— LDREXB/STREXB in preference to SWPB.
• If the translation table entries that relate to a memory location accessed by the SWP or SWPB instruction change,
or are seen to change by the executing processor as a result of TLB eviction, this might mean that the
translation table attributes, permissions or addresses for the load are different to those for the store. In this
case, the architecture makes no guarantee that no memory access occur to these memory locations between
the load and store.
The Virtualization Extensions make the SWP and SWPB instructions OPTIONAL and deprecated:
• If an implementation does not include the SWP and SWPB instructions, the ID_ISAR0.Swap_instrs and
ID_ISAR4.SWP_frac fields are zero, see About the Instruction Set Attribute registers on page B7-1940.
• In an implementation that includes SWP and SWPB, both instructions are UNDEFINED in Hyp mode.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 B 0 0 Rn Rt (0) (0) (0) (0) 1 0 0 1 Rt2
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-723
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SWP{B}{<c>}{<q>} <Rt>, <Rt2>, [<Rn>]
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if CurrentModeIsHyp() then UNDEFINED;
// The MemA[] accesses in the next two statements are locked together, that is, the memory
// system must ensure that no other access to the same location can occur between them.
data = ZeroExtend(MemA[R[n], size],32);
MemA[R[n], size] = R[t2]<8*size-1:0>;
if size == 1 then // SWPB
R[t] = data;
else // SWP
// Rotation in the following will always be by zero in ARMv7, due to alignment checks,
// but can be nonzero in legacy configurations.
R[t] = ROR(data, 8*UInt(R[n]<1:0>));
Exceptions
Data Abort.
A8-724 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.231 SXTAB
Signed Extend and Add Byte extracts an 8-bit value from a register, sign-extends it to 32 bits, adds the result to the
value in another register, and writes the final result to the destination register. The instruction can specify a rotation
by 0, 8, 16, or 24 bits before extracting the 8-bit value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 1 0 0 Rn 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-725
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SXTAB{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = R[n] + SignExtend(rotated<7:0>, 32);
Exceptions
None.
A8-726 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.232 SXTAB16
Signed Extend and Add Byte 16 extracts two 8-bit values from a register, sign-extends them to 16 bits each, adds
the results to two 16-bit values from another register, and writes the final results to the destination register. The
instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the 8-bit values.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 1 0 Rn 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 0 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-727
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SXTAB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d]<15:0> = R[n]<15:0> + SignExtend(rotated<7:0>, 16);
R[d]<31:16> = R[n]<31:16> + SignExtend(rotated<23:16>, 16);
Exceptions
None.
A8-728 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.233 SXTAH
Signed Extend and Add Halfword extracts a 16-bit value from a register, sign-extends it to 32 bits, adds the result
to a value from another register, and writes the final result to the destination register. The instruction can specify a
rotation by 0, 8, 16, or 24 bits before extracting the 16-bit value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 0 0 Rn 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 1 Rn Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-729
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SXTAH{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = R[n] + SignExtend(rotated<15:0>, 32);
Exceptions
None.
A8-730 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.234 SXTB
Signed Extend Byte extracts an 8-bit value from a register, sign-extends it to 32 bits, and writes the result to the
destination register. The instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the 8-bit value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 0 1 0 0 1 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 1 0 0 1 1 1 1 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-731
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SXTB{<c>}{<q>} {<Rd>,} <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = SignExtend(rotated<7:0>, 32);
Exceptions
None.
A8-732 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.235 SXTB16
Signed Extend Byte 16 extracts two 8-bit values from a register, sign-extends them to 16 bits each, and writes the
results to the destination register. The instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the
8-bit values.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 0 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-733
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SXTB16{<c>}{<q>} {<Rd>,} <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d]<15:0> = SignExtend(rotated<7:0>, 16);
R[d]<31:16> = SignExtend(rotated<23:16>, 16);
Exceptions
None.
A8-734 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.236 SXTH
Signed Extend Halfword extracts a 16-bit value from a register, sign-extends it to 32 bits, and writes the result to
the destination register. The instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the 16-bit
value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 0 1 0 0 0 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 0 1 1 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-735
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
SXTH{<c>}{<q>} {<Rd>,} <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = SignExtend(rotated<15:0>, 32);
Exceptions
None.
A8-736 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Table Branch Halfword causes a PC-relative forward branch using a table of single halfword offsets. A base register
provides a pointer to the table, and a second register supplies an index into the table. The branch length is twice the
value of the halfword returned from the table.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 0 0 1 1 0 1 Rn (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 H Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-737
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TBB{<c>}{<q>} [<Rn>, <Rm>]
where:
<Rn> The base register. This contains the address of the table of branch lengths. The PC can be used. If it
is, the table immediately follows this instruction.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
if is_tbh then
halfwords = UInt(MemU[R[n]+LSL(R[m],1), 2]);
else
halfwords = UInt(MemU[R[n]+R[m], 1]);
BranchWritePC(PC + 2*halfwords);
Exceptions
Data Abort.
A8-738 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 1 0 0 1 Rn 0 imm3 1 1 1 1 imm8
n = UInt(Rn);
(imm32, carry) = ThumbExpandImm_C(i:imm3:imm8, APSR.C);
if n IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 1 Rn (0) (0) (0) (0) imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
n = UInt(Rn);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-739
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TEQ{<c>}{<q>} <Rn>, #<const>
where:
<Rn> The operand register. The PC can be used in ARM instructions, but ARM deprecates this use of the
PC.
<const> The immediate value to be tested against the value obtained from <Rn>. See Modified immediate
constants in Thumb instructions on page A6-230 or Modified immediate constants in ARM
instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] EOR imm32;
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-740 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 1 0 0 1 Rn (0) imm3 1 1 1 1 imm2 type Rm
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm3:imm2);
if n IN {13,15} || m IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 1 Rn (0) (0) (0) (0) imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-741
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TEQ{<c>}{<q>} <Rn>, <Rm> {, <shift>}
where:
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If omitted, no shift is applied. Shifts applied to a
register on page A8-289 describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] EOR shifted;
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-742 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 1 1 Rn (0) (0) (0) (0) Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-743
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TEQ{<c>}{<q>} <Rn>, <Rm>, <type> <Rs>
where:
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] EOR shifted;
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-744 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 i 0 0 0 0 0 1 Rn 0 imm3 1 1 1 1 imm8
n = UInt(Rn);
(imm32, carry) = ThumbExpandImm_C(i:imm3:imm8, APSR.C);
if n IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 0 1 Rn (0) (0) (0) (0) imm12
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
n = UInt(Rn);
(imm32, carry) = ARMExpandImm_C(imm12, APSR.C);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-745
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TST{<c>}{<q>} <Rn>, #<const>
where:
<Rn> The operand register. The PC can be used in ARM instructions, but ARM deprecates this use of the
PC.
<const> The immediate value to be tested against the value obtained from <Rn>. See Modified immediate
constants in Thumb instructions on page A6-230 or Modified immediate constants in ARM
instructions on page A5-197 for the range of values.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = R[n] AND imm32;
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-746 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 1 0 0 0 Rm Rn
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = (SRType_LSL, 0);
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 0 1 0 0 0 0 1 Rn (0) imm3 1 1 1 1 imm2 type Rm
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm3:imm2);
if n IN {13,15} || m IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 0 1 Rn (0) (0) (0) (0) imm5 type 0 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
n = UInt(Rn); m = UInt(Rm);
(shift_t, shift_n) = DecodeImmShift(type, imm5);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-747
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TST{<c>}{<q>} <Rn>, <Rm> {, <shift>}
where:
<Rn> The first operand register. The PC can be used in ARM instructions, but ARM deprecates this use
of the PC.
<Rm> The register that is optionally shifted and used as the second operand. The PC can be used in ARM
instructions, but ARM deprecates this use of the PC.
<shift> The shift to apply to the value read from <Rm>. If present, encoding T1 is not permitted. If absent, no
shift is applied and all encodings are permitted. Shifts applied to a register on page A8-289
describes the shifts and how they are encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] AND shifted;
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-748 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 1 0 0 0 1 Rn (0) (0) (0) (0) Rs 0 type 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-749
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
TST{<c>}{<q>} <Rn>, <Rm>, <type> <Rs>
where:
<Rm> The register that is shifted and used as the second operand.
<type> The type of shift to apply to the value read from <Rm>. It must be one of:
ASR Arithmetic shift right, encoded as type = 0b10.
LSL Logical shift left, encoded as type = 0b00.
LSR Logical shift right, encoded as type = 0b01.
ROR Rotate right, encoded as type = 0b11.
<Rs> The register whose bottom byte contains the amount to shift by.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
shift_n = UInt(R[s]<7:0>);
(shifted, carry) = Shift_C(R[m], shift_t, shift_n, APSR.C);
result = R[n] AND shifted;
APSR.N = result<31>;
APSR.Z = IsZeroBit(result);
APSR.C = carry;
// APSR.V unchanged
Exceptions
None.
A8-750 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.244 UADD16
Unsigned Add 16 performs two 16-bit unsigned integer additions, and writes the results to the destination register.
It sets the APSR.GE bits according to the results of the additions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rn 1 1 1 1 Rd 0 1 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-751
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<15:0>) + UInt(R[m]<15:0>);
sum2 = UInt(R[n]<31:16>) + UInt(R[m]<31:16>);
R[d]<15:0> = sum1<15:0>;
R[d]<31:16> = sum2<15:0>;
APSR.GE<1:0> = if sum1 >= 0x10000 then ‘11’ else ‘00’;
APSR.GE<3:2> = if sum2 >= 0x10000 then ‘11’ else ‘00’;
Exceptions
None.
A8-752 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.245 UADD8
Unsigned Add 8 performs four unsigned 8-bit integer additions, and writes the results to the destination register. It
sets the APSR.GE bits according to the results of the additions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 0 1 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-753
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UADD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<7:0>) + UInt(R[m]<7:0>);
sum2 = UInt(R[n]<15:8>) + UInt(R[m]<15:8>);
sum3 = UInt(R[n]<23:16>) + UInt(R[m]<23:16>);
sum4 = UInt(R[n]<31:24>) + UInt(R[m]<31:24>);
R[d]<7:0> = sum1<7:0>;
R[d]<15:8> = sum2<7:0>;
R[d]<23:16> = sum3<7:0>;
R[d]<31:24> = sum4<7:0>;
APSR.GE<0> = if sum1 >= 0x100 then ‘1’ else ‘0’;
APSR.GE<1> = if sum2 >= 0x100 then ‘1’ else ‘0’;
APSR.GE<2> = if sum3 >= 0x100 then ‘1’ else ‘0’;
APSR.GE<3> = if sum4 >= 0x100 then ‘1’ else ‘0’;
Exceptions
None.
A8-754 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.246 UASX
Unsigned Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one
unsigned 16-bit integer addition and one unsigned 16-bit subtraction, and writes the results to the destination
register. It sets the APSR.GE bits according to the results.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 0 1 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-755
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UASX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff = UInt(R[n]<15:0>) - UInt(R[m]<31:16>);
sum = UInt(R[n]<31:16>) + UInt(R[m]<15:0>);
R[d]<15:0> = diff<15:0>;
R[d]<31:16> = sum<15:0>;
APSR.GE<1:0> = if diff >= 0 then ‘11’ else ‘00’;
APSR.GE<3:2> = if sum >= 0x10000 then ‘11’ else ‘00’;
Exceptions
None.
A8-756 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.247 UBFX
Unsigned Bit Field Extract extracts any number of adjacent bits at any position from a register, zero-extends them
to 32 bits, and writes the result to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 1 1 0 0 Rn 0 imm3 Rd imm2 (0) widthm1
d = UInt(Rd); n = UInt(Rn);
lsbit = UInt(imm3:imm2); widthminus1 = UInt(widthm1);
if d IN {13,15} || n IN {13,15} then UNPREDICTABLE;
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 1 1 1 widthm1 Rd lsb 1 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
d = UInt(Rd); n = UInt(Rn);
lsbit = UInt(lsb); widthminus1 = UInt(widthm1);
if d == 15 || n == 15 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-757
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UBFX{<c>}{<q>} <Rd>, <Rn>, #<lsb>, #<width>
where:
<lsb> is the bit number of the least significant bit in the field, in the range 0-31. This determines the
required value of lsbit.
<width> is the width of the field, in the range 1 to 32-<lsb>. The required value of widthminus1 is <width>-1.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
msbit = lsbit + widthminus1;
if msbit <= 31 then
R[d] = ZeroExtend(R[n]<msbit:lsbit>, 32);
else
UNPREDICTABLE;
Exceptions
None.
A8-758 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.248 UDF
Permanently Undefined generates an Undefined Instruction exception.
The encodings for UDF used in this section are defined as permanently UNDEFINED in the versions of the architecture
specified in this section. Issue C.a of this manual first defines an assembler mnemonic for these encodings.
However:
• with the Thumb instruction set, ARM deprecates using the UDF instruction in an IT block
• in the ARM instruction set, UDF is not conditional.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 1 1 1 1 0 imm8
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 1 1 1 1 1 1 imm4 1 0 1 0 imm12
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 0 1 1 1 1 1 1 1 imm12 1 1 1 1 imm4
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-759
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UDF{<c>}{<q>} {#}<imm>
where:
<imm> Specifies an immediate constant, that is 8-bit in encoding T1, and 16-bit in encodings T2 and A1.
The processor ignores the value of this constant.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
UNDEFINED;
Exceptions
Undefined Instruction.
A8-760 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.249 UDIV
Unsigned Divide divides a 32-bit unsigned integer register value by a 32-bit unsigned integer register value, and
writes the result to the destination register. The condition flags are not affected.
See ARMv7 implementation requirements and options for the divide instructions on page A4-170 for more
information about this instruction.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 0 1 1 Rn (1) (1) (1) (1) Rd 1 1 1 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 0 0 1 1 Rd (1) (1) (1) (1) Rm 0 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-761
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UDIV{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if UInt(R[m]) == 0 then
if IntegerZeroDivideTrappingEnabled() then
GenerateIntegerZeroDivide();
else
result = 0;
else
result = RoundTowardsZero(UInt(R[n]) / UInt(R[m]));
R[d] = result<31:0>;
Exceptions
In ARMv7-R profile, Undefined Instruction, see Divide instructions on page A4-170.
A8-762 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.250 UHADD16
Unsigned Halving Add 16 performs two unsigned 16-bit integer additions, halves the results, and writes the results
to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rn 1 1 1 1 Rd 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 1 Rn Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-763
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UHADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<15:0>) + UInt(R[m]<15:0>);
sum2 = UInt(R[n]<31:16>) + UInt(R[m]<31:16>);
R[d]<15:0> = sum1<16:1>;
R[d]<31:16> = sum2<16:1>;
Exceptions
None.
A8-764 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.251 UHADD8
Unsigned Halving Add 8 performs four unsigned 8-bit integer additions, halves the results, and writes the results to
the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 1 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-765
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UHADD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<7:0>) + UInt(R[m]<7:0>);
sum2 = UInt(R[n]<15:8>) + UInt(R[m]<15:8>);
sum3 = UInt(R[n]<23:16>) + UInt(R[m]<23:16>);
sum4 = UInt(R[n]<31:24>) + UInt(R[m]<31:24>);
R[d]<7:0> = sum1<8:1>;
R[d]<15:8> = sum2<8:1>;
R[d]<23:16> = sum3<8:1>;
R[d]<31:24> = sum4<8:1>;
Exceptions
None.
A8-766 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.252 UHASX
Unsigned Halving Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs
one unsigned 16-bit integer addition and one unsigned 16-bit subtraction, halves the results, and writes the results
to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 1 Rn Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-767
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UHASX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff = UInt(R[n]<15:0>) - UInt(R[m]<31:16>);
sum = UInt(R[n]<31:16>) + UInt(R[m]<15:0>);
R[d]<15:0> = diff<16:1>;
R[d]<31:16> = sum<16:1>;
Exceptions
None.
A8-768 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.253 UHSAX
Unsigned Halving Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs
one unsigned 16-bit integer subtraction and one unsigned 16-bit addition, halves the results, and writes the results
to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 1 0 Rn 1 1 1 1 Rd 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-769
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UHSAX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum = UInt(R[n]<15:0>) + UInt(R[m]<31:16>);
diff = UInt(R[n]<31:16>) - UInt(R[m]<15:0>);
R[d]<15:0> = sum<16:1>;
R[d]<31:16> = diff<16:1>;
Exceptions
None.
A8-770 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.254 UHSUB16
Unsigned Halving Subtract 16 performs two unsigned 16-bit integer subtractions, halves the results, and writes the
results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 1 Rn 1 1 1 1 Rd 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-771
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UHSUB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<15:0>) - UInt(R[m]<15:0>);
diff2 = UInt(R[n]<31:16>) - UInt(R[m]<31:16>);
R[d]<15:0> = diff1<16:1>;
R[d]<31:16> = diff2<16:1>;
Exceptions
None.
A8-772 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.255 UHSUB8
Unsigned Halving Subtract 8 performs four unsigned 8-bit integer subtractions, halves the results, and writes the
results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 0 Rn 1 1 1 1 Rd 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-773
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UHSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<7:0>) - UInt(R[m]<7:0>);
diff2 = UInt(R[n]<15:8>) - UInt(R[m]<15:8>);
diff3 = UInt(R[n]<23:16>) - UInt(R[m]<23:16>);
diff4 = UInt(R[n]<31:24>) - UInt(R[m]<31:24>);
R[d]<7:0> = diff1<8:1>;
R[d]<15:8> = diff2<8:1>;
R[d]<23:16> = diff3<8:1>;
R[d]<31:24> = diff4<8:1>;
Exceptions
None.
A8-774 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.256 UMAAL
Unsigned Multiply Accumulate Accumulate Long multiplies two unsigned 32-bit values to produce a 64-bit value,
adds two unsigned 32-bit values, and writes the 64-bit result to two registers.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 1 1 0 Rn RdLo RdHi 0 1 1 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 0 1 0 0 RdHi RdLo Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-775
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UMAAL{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
<RdLo> Supplies one of the 32-bit values to be added, and is the destination register for the lower 32 bits of
the result.
<RdHi> Supplies the other of the 32-bit values to be added, and is the destination register for the upper
32 bits of the result.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = UInt(R[n]) * UInt(R[m]) + UInt(R[dHi]) + UInt(R[dLo]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
Exceptions
None.
A8-776 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.257 UMLAL
Unsigned Multiply Accumulate Long multiplies two unsigned 32-bit values to produce a 64-bit value, and
accumulates this with a 64-bit value.
In ARM instructions, the condition flags can optionally be updated based on the result. Use of this option adversely
affects performance on many processor implementations.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 1 1 0 Rn RdLo RdHi 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 1 S RdHi RdLo Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-777
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UMLAL{S}{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
S can be specified only for the ARM instruction set.
<RdLo> Supplies the lower 32 bits of the accumulate value, and is the destination register for the lower 32
bits of the result.
<RdHi> Supplies the upper 32 bits of the accumulate value, and is the destination register for the upper 32
bits of the result.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = UInt(R[n]) * UInt(R[m]) + UInt(R[dHi]:R[dLo]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
if setflags then
APSR.N = result<63>;
APSR.Z = IsZeroBit(result<63:0>);
if ArchVersion() == 4 then
APSR.C = bit UNKNOWN;
APSR.V = bit UNKNOWN;
// else APSR.C, APSR.V unchanged
Exceptions
None.
A8-778 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.258 UMULL
Unsigned Multiply Long multiplies two 32-bit unsigned values to produce a 64-bit result.
In ARM instructions, the condition flags can optionally be updated based on the result. Use of this option adversely
affects performance on many processor implementations.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 1 0 1 0 Rn RdLo RdHi 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 0 0 1 0 0 S RdHi RdLo Rm 1 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-779
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UMULL{S}{<c>}{<q>} <RdLo>, <RdHi>, <Rn>, <Rm>
where:
S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.
S can be specified only for the ARM instruction set.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
result = UInt(R[n]) * UInt(R[m]);
R[dHi] = result<63:32>;
R[dLo] = result<31:0>;
if setflags then
APSR.N = result<63>;
APSR.Z = IsZeroBit(result<63:0>);
if ArchVersion() == 4 then
APSR.C = bit UNKNOWN;
APSR.V = bit UNKNOWN;
// else APSR.C, APSR.V unchanged
Exceptions
None.
A8-780 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.259 UQADD16
Unsigned Saturating Add 16 performs two unsigned 16-bit integer additions, saturates the results to the 16-bit
unsigned integer range 0 ≤ x ≤ 216 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 1 Rn 1 1 1 1 Rd 0 1 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 0 Rn Rd (1) (1) (1) (1) 0 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-781
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UQADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<15:0>) + UInt(R[m]<15:0>);
sum2 = UInt(R[n]<31:16>) + UInt(R[m]<31:16>);
R[d]<15:0> = UnsignedSat(sum1, 16);
R[d]<31:16> = UnsignedSat(sum2, 16);
Exceptions
None.
A8-782 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.260 UQADD8
Unsigned Saturating Add 8 performs four unsigned 8-bit integer additions, saturates the results to the 8-bit unsigned
integer range 0 ≤ x ≤ 28 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 0 0 Rn 1 1 1 1 Rd 0 1 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 0 Rn Rd (1) (1) (1) (1) 1 0 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-783
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UQADD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<7:0>) + UInt(R[m]<7:0>);
sum2 = UInt(R[n]<15:8>) + UInt(R[m]<15:8>);
sum3 = UInt(R[n]<23:16>) + UInt(R[m]<23:16>);
sum4 = UInt(R[n]<31:24>) + UInt(R[m]<31:24>);
R[d]<7:0> = UnsignedSat(sum1, 8);
R[d]<15:8> = UnsignedSat(sum2, 8);
R[d]<23:16> = UnsignedSat(sum3, 8);
R[d]<31:24> = UnsignedSat(sum4, 8);
Exceptions
None.
A8-784 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.261 UQASX
Unsigned Saturating Add and Subtract with Exchange exchanges the two halfwords of the second operand,
performs one unsigned 16-bit integer addition and one unsigned 16-bit subtraction, saturates the results to the 16-bit
unsigned integer range 0 ≤ x ≤ 216 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 0 1 0 Rn 1 1 1 1 Rd 0 1 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 0 Rn Rd (1) (1) (1) (1) 0 0 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-785
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UQASX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff = UInt(R[n]<15:0>) - UInt(R[m]<31:16>);
sum = UInt(R[n]<31:16>) + UInt(R[m]<15:0>);
R[d]<15:0> = UnsignedSat(diff, 16);
R[d]<31:16> = UnsignedSat(sum, 16);
Exceptions
None.
A8-786 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.262 UQSAX
Unsigned Saturating Subtract and Add with Exchange exchanges the two halfwords of the second operand,
performs one unsigned 16-bit integer subtraction and one unsigned 16-bit addition, saturates the results to the 16-bit
unsigned integer range 0 ≤ x ≤ 216 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 1 0 Rn 1 1 1 1 Rd 0 1 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 0 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-787
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UQSAX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum = UInt(R[n]<15:0>) + UInt(R[m]<31:16>);
diff = UInt(R[n]<31:16>) - UInt(R[m]<15:0>);
R[d]<15:0> = UnsignedSat(sum, 16);
R[d]<31:16> = UnsignedSat(diff, 16);
Exceptions
None.
A8-788 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.263 UQSUB16
Unsigned Saturating Subtract 16 performs two unsigned 16-bit integer subtractions, saturates the results to the
16-bit unsigned integer range 0 ≤ x ≤ 216 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 1 Rn 1 1 1 1 Rd 0 1 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 0 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-789
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UQSUB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<15:0>) - UInt(R[m]<15:0>);
diff2 = UInt(R[n]<31:16>) - UInt(R[m]<31:16>);
R[d]<15:0> = UnsignedSat(diff1, 16);
R[d]<31:16> = UnsignedSat(diff2, 16);
Exceptions
None.
A8-790 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.264 UQSUB8
Unsigned Saturating Subtract 8 performs four unsigned 8-bit integer subtractions, saturates the results to the 8-bit
unsigned integer range 0 ≤ x ≤ 28 – 1, and writes the results to the destination register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 0 Rn 1 1 1 1 Rd 0 1 0 1 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 1 0 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-791
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UQSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<7:0>) - UInt(R[m]<7:0>);
diff2 = UInt(R[n]<15:8>) - UInt(R[m]<15:8>);
diff3 = UInt(R[n]<23:16>) - UInt(R[m]<23:16>);
diff4 = UInt(R[n]<31:24>) - UInt(R[m]<31:24>);
R[d]<7:0> = UnsignedSat(diff1, 8);
R[d]<15:8> = UnsignedSat(diff2, 8);
R[d]<23:16> = UnsignedSat(diff3, 8);
R[d]<31:24> = UnsignedSat(diff4, 8);
Exceptions
None.
A8-792 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.265 USAD8
Unsigned Sum of Absolute Differences performs four unsigned 8-bit subtractions, and adds the absolute values of
the differences together.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 1 1 Rn 1 1 1 1 Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 1 0 0 0 Rd 1 1 1 1 Rm 0 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-793
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USAD8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
absdiff1 = Abs(UInt(R[n]<7:0>) - UInt(R[m]<7:0>));
absdiff2 = Abs(UInt(R[n]<15:8>) - UInt(R[m]<15:8>));
absdiff3 = Abs(UInt(R[n]<23:16>) - UInt(R[m]<23:16>));
absdiff4 = Abs(UInt(R[n]<31:24>) - UInt(R[m]<31:24>));
result = absdiff1 + absdiff2 + absdiff3 + absdiff4;
R[d] = result<31:0>;
Exceptions
None.
A8-794 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.266 USADA8
Unsigned Sum of Absolute Differences and Accumulate performs four unsigned 8-bit subtractions, and adds the
absolute values of the differences to a 32-bit accumulate operand.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 1 1 1 Rn Ra Rd 0 0 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 1 1 0 0 0 Rd Ra Rm 0 0 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-795
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USADA8{<c>}{<q>} <Rd>, <Rn>, <Rm>, <Ra>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
absdiff1 = Abs(UInt(R[n]<7:0>) - UInt(R[m]<7:0>));
absdiff2 = Abs(UInt(R[n]<15:8>) - UInt(R[m]<15:8>));
absdiff3 = Abs(UInt(R[n]<23:16>) - UInt(R[m]<23:16>));
absdiff4 = Abs(UInt(R[n]<31:24>) - UInt(R[m]<31:24>));
result = UInt(R[a]) + absdiff1 + absdiff2 + absdiff3 + absdiff4;
R[d] = result<31:0>;
Exceptions
None.
A8-796 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.267 USAT
Unsigned Saturate saturates an optionally-shifted signed value to a selected unsigned range.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 1 0 sh 0 Rn 0 imm3 Rd imm2 (0) sat_imm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 sat_imm Rd imm5 sh 0 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-797
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USAT{<c>}{<q>} <Rd>, #<imm>, <Rn> {, <shift>}
where:
<imm> The bit position for saturation, in the range 0 to 31. This is encoded directly in the sat_imm field of
the instruction, meaning sat_imm takes the value of <imm>.
<shift> The optional shift, encoded in the sh bit and the immsh field, where immsh is:
• imm3:imm2 for encoding T1
• imm5 for encoding A1.
<shift> must be one of:
omitted No shift. Encoded as sh = 0, immsh = 0b00000.
LSL #<n> Left shift by <n> bits, with <n> in the range 1-31.
Encoded as sh = 0, immsh = <n>.
ASR #<n> Arithmetic right shift by <n> bits, with <n> in the range 1-31.
Encoded as sh = 1, immsh = <n>.
ASR #32 Arithmetic right shift by 32 bits, permitted only for encoding A1.
Encoded as sh = 1, immsh = 0b00000.
Note
An assembler can permit ASR #0 or LSL #0 to mean the same thing as omitting the shift, but this is
not standard UAL and must not be used for disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
operand = Shift(R[n], shift_t, shift_n, APSR.C); // APSR.C ignored
(result, sat) = UnsignedSatQ(SInt(operand), saturate_to);
R[d] = ZeroExtend(result, 32);
if sat then
APSR.Q = ‘1’;
Exceptions
None.
A8-798 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.268 USAT16
Unsigned Saturate 16 saturates two signed 16-bit values to a selected unsigned range.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 (0) 1 1 1 0 1 0 Rn 0 0 0 0 Rd 0 0 (0) (0) sat_imm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 0 sat_imm Rd (1) (1) (1) (1) 0 0 1 1 Rn
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-799
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USAT16{<c>}{<q>} <Rd>, #<imm>, <Rn>
where:
<imm> The bit position for saturation, in the range 0 to 15. This is encoded directly in the sat_imm field of
the instruction, meaning sat_imm takes the value of <imm>.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result1, sat1) = UnsignedSatQ(SInt(R[n]<15:0>), saturate_to);
(result2, sat2) = UnsignedSatQ(SInt(R[n]<31:16>), saturate_to);
R[d]<15:0> = ZeroExtend(result1, 16);
R[d]<31:16> = ZeroExtend(result2, 16);
if sat1 || sat2 then
APSR.Q = ‘1’;
Exceptions
None.
A8-800 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.269 USAX
Unsigned Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs one
unsigned 16-bit integer subtraction and one unsigned 16-bit addition, and writes the results to the destination
register. It sets the APSR.GE bits according to the results.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 1 0 Rn 1 1 1 1 Rd 0 1 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 1 0 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-801
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USAX{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum = UInt(R[n]<15:0>) + UInt(R[m]<31:16>);
diff = UInt(R[n]<31:16>) - UInt(R[m]<15:0>);
R[d]<15:0> = sum<15:0>;
R[d]<31:16> = diff<15:0>;
APSR.GE<1:0> = if sum >= 0x10000 then ‘11’ else ‘00’;
APSR.GE<3:2> = if diff >= 0 then ‘11’ else ‘00’;
Exceptions
None.
A8-802 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.270 USUB16
Unsigned Subtract 16 performs two 16-bit unsigned integer subtractions, and writes the results to the destination
register. It sets the APSR.GE bits according to the results of the subtractions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 1 Rn 1 1 1 1 Rd 0 1 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-803
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USUB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<15:0>) - UInt(R[m]<15:0>);
diff2 = UInt(R[n]<31:16>) - UInt(R[m]<31:16>);
R[d]<15:0> = diff1<15:0>;
R[d]<31:16> = diff2<15:0>;
APSR.GE<1:0> = if diff1 >= 0 then ‘11’ else ‘00’;
APSR.GE<3:2> = if diff2 >= 0 then ‘11’ else ‘00’;
Exceptions
None.
A8-804 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.271 USUB8
Unsigned Subtract 8 performs four 8-bit unsigned integer subtractions, and writes the results to the destination
register. It sets the APSR.GE bits according to the results of the subtractions.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 1 1 0 0 Rn 1 1 1 1 Rd 0 1 0 0 Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 0 1 0 1 Rn Rd (1) (1) (1) (1) 1 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-805
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
USUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<7:0>) - UInt(R[m]<7:0>);
diff2 = UInt(R[n]<15:8>) - UInt(R[m]<15:8>);
diff3 = UInt(R[n]<23:16>) - UInt(R[m]<23:16>);
diff4 = UInt(R[n]<31:24>) - UInt(R[m]<31:24>);
R[d]<7:0> = diff1<7:0>;
R[d]<15:8> = diff2<7:0>;
R[d]<23:16> = diff3<7:0>;
R[d]<31:24> = diff4<7:0>;
APSR.GE<0> = if diff1 >= 0 then ‘1’ else ‘0’;
APSR.GE<1> = if diff2 >= 0 then ‘1’ else ‘0’;
APSR.GE<2> = if diff3 >= 0 then ‘1’ else ‘0’;
APSR.GE<3> = if diff4 >= 0 then ‘1’ else ‘0’;
Exceptions
None.
A8-806 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.272 UXTAB
Unsigned Extend and Add Byte extracts an 8-bit value from a register, zero-extends it to 32 bits, adds the result to
the value in another register, and writes the final result to the destination register. The instruction can specify a
rotation by 0, 8, 16, or 24 bits before extracting the 8-bit value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 1 0 1 Rn 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-807
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UXTAB{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = R[n] + ZeroExtend(rotated<7:0>, 32);
Exceptions
None.
A8-808 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.273 UXTAB16
Unsigned Extend and Add Byte 16 extracts two 8-bit values from a register, zero-extends them to 16 bits each, adds
the results to two 16-bit values from another register, and writes the final results to the destination register. The
instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the 8-bit values.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 1 1 Rn 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 0 0 Rn Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-809
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UXTAB16{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d]<15:0> = R[n]<15:0> + ZeroExtend(rotated<7:0>, 16);
R[d]<31:16> = R[n]<31:16> + ZeroExtend(rotated<23:16>, 16);
Exceptions
None.
A8-810 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.274 UXTAH
Unsigned Extend and Add Halfword extracts a 16-bit value from a register, zero-extends it to 32 bits, adds the result
to a value from another register, and writes the final result to the destination register. The instruction can specify a
rotation by 0, 8, 16, or 24 bits before extracting the 16-bit value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 0 1 Rn 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 1 Rn Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-811
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UXTAH{<c>}{<q>} {<Rd>,} <Rn>, <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = R[n] + ZeroExtend(rotated<15:0>, 32);
Exceptions
None.
A8-812 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.275 UXTB
Unsigned Extend Byte extracts an 8-bit value from a register, zero-extends it to 32 bits, and writes the result to the
destination register. The instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the 8-bit value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 0 1 0 1 1 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-813
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UXTB{<c>}{<q>} {<Rd>,} <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = ZeroExtend(rotated<7:0>, 32);
Exceptions
None.
A8-814 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.276 UXTB16
Unsigned Extend Byte 16 extracts two 8-bit values from a register, zero-extends them to 16 bits each, and writes
the results to the destination register. The instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting
the 8-bit values.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 0 0 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-815
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UXTB16{<c>}{<q>} {<Rd>,} <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d]<15:0> = ZeroExtend(rotated<7:0>, 16);
R[d]<31:16> = ZeroExtend(rotated<23:16>, 16);
Exceptions
None.
A8-816 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.277 UXTH
Unsigned Extend Halfword extracts a 16-bit value from a register, zero-extends it to 32 bits, and writes the result to
the destination register. The instruction can specify a rotation by 0, 8, 16, or 24 bits before extracting the 16-bit
value.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 0 1 0 1 0 Rm Rd
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 Rd 1 (0) rotate Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 1 1 0 1 1 1 1 1 1 1 1 Rd rotate (0) (0) 0 1 1 1 Rm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-817
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
UXTH{<c>}{<q>} {<Rd>,} <Rm> {, <rotation>}
where:
Note
An assembler can permit ROR #0 to mean the same thing as omitting the rotation, possibly with
restrictions on the permitted encodings, but this is not standard UAL and must not be used for
disassembly.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
rotated = ROR(R[m], rotation);
R[d] = ZeroExtend(rotated<15:0>, 32);
Exceptions
None.
A8-818 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Operand and result elements are either all integers of the same length, or optionally the results can be double the
length of the operands.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction that is not also available as a VFP
instruction, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 1 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 1 N Q M 1 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 0 1 0 1 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 0 1 0 1 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-819
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VABA{<c>}{<q>}.<dt> <Qd>, <Qn>, <Qm> Encoding T1/A1, Q = 1
VABA{<c>}{<q>}.<dt> <Dd>, <Dn>, <Dm> Encoding T1/A1, Q = 0
VABAL{<c>}{<q>}.<dt> <Qd>, <Dn>, <Dm> Encoding T2/A2
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VABA or VABAL instruction
must be unconditional. ARM strongly recommends that a Thumb VABA or VABAL instruction
is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
S8 encoded as size = 0b00, U = 0.
S16 encoded as size = 0b01, U = 0.
S32 encoded as size = 0b10, U = 0.
U8 encoded as size = 0b00, U = 1.
U16 encoded as size = 0b01, U = 1.
U32 encoded as size = 0b10, U = 1.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Qd>, <Dn>, <Dm> The destination vector and the operand vectors, for a long operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[Din[n+r],e,esize];
op2 = Elem[Din[m+r],e,esize];
absdiff = Abs(Int(op1,unsigned) - Int(op2,unsigned));
if long_destination then
Elem[Q[d>>1],e,2*esize] = Elem[Qin[d>>1],e,2*esize] + absdiff;
else
Elem[D[d+r],e,esize] = Elem[Din[d+r],e,esize] + absdiff;
Exceptions
Undefined Instruction, Hyp Trap.
A8-820 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Operand and result elements are either all integers of the same length, or optionally the results can be double the
length of the operands.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction that is not also available as a VFP
instruction, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 1 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 1 N Q M 0 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 0 1 1 1 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 0 1 1 1 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-821
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VABD{<c>}{<q>}.<dt> {<Qd>, }<Qn>, <Qm> Encoding T1/A1, Q = 1
VABD{<c>}{<q>}.<dt> {<Dd>, }<Dn>, <Dm> Encoding T1/A1, Q = 0
VABDL{<c>}{<q>}.<dt> <Qd>, <Dn>, <Dm> Encoding T2/A2
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VABD or VABDL instruction
must be unconditional. ARM strongly recommends that a Thumb VABD or VABDL instruction
is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
S8 encoded as size = 0b00, U = 0.
S16 encoded as size = 0b01, U = 0.
S32 encoded as size = 0b10, U = 0.
U8 encoded as size = 0b00, U = 1.
U16 encoded as size = 0b01, U = 1.
U32 encoded as size = 0b10, U = 1.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Qd>, <Dn>, <Dm> The destination vector and the operand vectors, for a long operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[Din[n+r],e,esize];
op2 = Elem[Din[m+r],e,esize];
absdiff = Abs(Int(op1,unsigned) - Int(op2,unsigned));
if long_destination then
Elem[Q[d>>1],e,2*esize] = absdiff<2*esize-1:0>;
else
Elem[D[d+r],e,esize] = absdiff<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-822 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction that is not also available as a VFP
instruction, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D 1 sz Vn Vd 1 1 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D 1 sz Vn Vd 1 1 0 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-823
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VABD{<c>}{<q>}.F32 {<Qd>, }<Qn>, <Qm> Encoded as Q = 1, sz = 0
VABD{<c>}{<q>}.F32 {<Dd>, }<Dn>, <Dm> Encoded as Q = 0, sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VABD instruction must be
unconditional. ARM strongly recommends that a Thumb VABD instruction is unconditional,
see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[D[n+r],e,esize]; op2 = Elem[D[m+r],e,esize];
Elem[D[d+r],e,esize] = FPAbs(FPSub(op1,op2,FALSE));
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-824 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.281 VABS
Vector Absolute takes the absolute value of each element in a vector, and places the results in a second vector. The
floating-point version only clears the sign bit.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction that is not also available as a VFP
instruction, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 0 Q M 0 Vm
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VABS<c>.F64 <Dd>, <Dm>
VABS<c>.F32 <Sd>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 1 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 1 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride}
fields. For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-825
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VABS{<c>}{<q>}.<dt> <Qd>, <Qm> Encoding T1/A1
VABS{<c>}{<q>}.<dt> <Dd>, <Dm> Encoding T1/A1
VABS{<c>}{<q>}.F32 <Sd>, <Sm> Floating-point only, encoding T2/A2, encoded as sz = 0
VABS{<c>}{<q>}.F64 <Dd>, <Dm> Encoding T2/A2, encoded as sz = 1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VABS instruction
must be unconditional. ARM strongly recommends that a Thumb Advanced SIMD VABS instruction
is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00, F = 0.
S16 Encoded as size = 0b01, F = 0.
S32 Encoded as size = 0b10, F = 0.
F32 Encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
<Sd>, <Sm> The destination vector and the operand vector, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
Elem[D[d+r],e,esize] = FPAbs(Elem[D[m+r],e,esize]);
else
result = Abs(SInt(Elem[D[m+r],e,esize]));
Elem[D[d+r],e,esize] = result<esize-1:0>;
else // VFP instruction
if dp_operation then
D[d] = FPAbs(D[m]);
else
S[d] = FPAbs(S[m]);
Exceptions
Undefined Instruction, Hyp Trap.
A8-826 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The operands and result can be quadword or doubleword vectors. They must all be the same size.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction that is not also available as a VFP
instruction, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D op sz Vn Vd 1 1 1 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D op sz Vn Vd 1 1 1 0 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
or_equal = (op == ‘0’); esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-827
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}.F32 {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
V<op>{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VACGE, VACGT, VACLE, or
VACLT instruction must be unconditional.ARM strongly recommends that a Thumb VACGE,
VACGT, VACLE, or VACLT instruction is unconditional, see Conditional execution on
page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = FPAbs(Elem[D[n+r],e,esize]); op2 = FPAbs(Elem[D[m+r],e,esize]);
if or_equal then
test_passed = FPCompareGE(op1, op2, FALSE);
else
test_passed = FPCompareGT(op1, op2, FALSE);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-828 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D size Vn Vd 1 0 0 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 0 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-829
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VADD{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm>
VADD{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VADD
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VADD instruction is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
I8 size = 0b00.
I16 size = 0b01.
I32 size = 0b10.
I64 size = 0b11.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = Elem[D[n+r],e,esize] + Elem[D[m+r],e,esize];
Exceptions
Undefined Instruction, Hyp Trap.
A8-830 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 0 sz Vn Vd 1 1 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 0 sz Vn Vd 1 1 0 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
advsimd = TRUE; esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VADD<c>.F64 <Dd>, <Dn>, <Dm>
VADD<c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 0 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride}
fields. For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-831
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VADD{<c>}{<q>}.F32 {<Qd>,} <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1, sz = 0
VADD{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0, sz = 0
VADD{<c>}{<q>}.F32 {<Sd>,} <Sn>, <Sm> Encoding T2/A2, encoded as sz = 0
VADD{<c>}{<q>}.F64 {<Dd>,} <Dn>, <Dm> Encoding T2/A2, encoded as sz = 1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VADD
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VADD instruction is unconditional, see Conditional execution on page A8-286
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Sd>, <Sn>, <Sm> The destination vector and the operand vectors, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = FPAdd(Elem[D[n+r],e,esize], Elem[D[m+r],e,esize], FALSE);
else // VFP instruction
if dp_operation then
D[d] = FPAdd(D[n], D[m], TRUE);
else
S[d] = FPAdd(S[n], S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-832 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.285 VADDHN
Vector Add and Narrow, returning High Half adds corresponding elements in two quadword vectors, and places the
most significant half of each result in a doubleword vector. The results are truncated. (For rounded results, see
VRADDHN on page A8-1023).
The operand elements can be 16-bit, 32-bit, or 64-bit integers. There is no distinction between signed and unsigned
integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-833
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VADDHN{<c>}{<q>}.<dt> <Dd>, <Qn>, <Qm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VADDHN instruction must be
unconditional.ARM strongly recommends that a Thumb VADDHN instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
I16 size = 0b00.
I32 size = 0b01.
I64 size = 0b10.
<Dd>, <Qn>, <Qm> The destination vector, the first operand vector, and the second operand vector.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
result = Elem[Qin[n>>1],e,2*esize] + Elem[Qin[m>>1],e,2*esize];
Elem[D[d],e,esize] = result<2*esize-1:esize>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-834 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 0 0 0 op N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 0 0 0 op N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-835
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VADDL{<c>}{<q>}.<dt> <Qd>, <Dn>, <Dm> Encoded as op = 0
VADDW{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Dm> Encoded as op = 1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VADDL or VADDW instruction must be
unconditional. ARM strongly recommends that a Thumb VADDL or VADDW instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data type for the elements of the second operand vector. It must be one of:
S8 encoded as size = 0b00, U = 0.
S16 encoded as size = 0b01, U = 0.
S32 encoded as size = 0b10, U = 0.
U8 encoded as size = 0b00, U = 1.
U16 encoded as size = 0b01, U = 1.
U32 encoded as size = 0b10, U = 1.
<Qd> The destination register. If this register is omitted in a VADDW instruction, it is the same register as
<Qn>.
<Qn>, <Dm> The first and second operand registers for a VADDW instruction.
<Dn>, <Dm> The first and second operand registers for a VADDL instruction.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
if is_vaddw then
op1 = Int(Elem[Qin[n>>1],e,2*esize], unsigned);
else
op1 = Int(Elem[Din[n],e,esize], unsigned);
result = op1 + Int(Elem[Din[m],e,esize],unsigned);
Elem[Q[d>>1],e,2*esize] = result<2*esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-836 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 0 0 Vn Vd 0 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 0 0 Vn Vd 0 0 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-837
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VAND{<c>}{<q>}{.<dt>} {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VAND{<c>}{<q>}{.<dt>} {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VAND instruction must be
unconditional. ARM strongly recommends that a Thumb VAND instruction is unconditional,
see Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[n+r] AND D[m+r];
Exceptions
Undefined Instruction, Hyp Trap.
A8-838 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 i 1 1 1 1 1 D 0 0 0 imm3 Vd cmode 0 Q 1 1 imm4
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode 0 Q 1 1 imm4
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-839
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VBIC{<c>}{<q>}.<dt> {<Qd>,} <Qd>, #<imm> Encoded as Q = 1
VBIC{<c>}{<q>}.<dt> {<Dd>,} <Dd>, #<imm>> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VBIC instruction must be
unconditional. ARM strongly recommends that a Thumb VBIC instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type used for <imm>. It can be either I16 or I32.
I8, I64, and F32 are also permitted, but the resulting syntax is a pseudo-instruction.
<imm> A constant of the type specified by <dt>. This constant is replicated enough times to fill the
destination register. For example, VBIC.I32 D0, #10 ANDs the complement of 0x0000000A0000000A
with D0, and puts the result into D0.
For details of the range of constants available and the encoding of <dt> and <imm>, see One register and a modified
immediate value on page A7-267.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[d+r] AND NOT(imm64);
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
VAND can be used with a range of constants that are the bitwise inverse of the available constants for VBIC. This is
assembled as the equivalent VBIC instruction. Disassembly produces the VBIC form.
One register and a modified immediate value on page A7-267 describes pseudo-instructions with a combination of
<dt> and <imm> that is not supported by hardware, but that generates the same destination register value as a different
combination that is supported by hardware.
A8-840 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 0 1 Vn Vd 0 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 0 1 Vn Vd 0 0 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-841
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VBIC{<c>}{<q>}{.<dt>} {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VBIC{<c>}{<q>}{.<dt>} {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VBIC instruction must be
unconditional. ARM strongly recommends that a Thumb VBIC instruction is unconditional,
see Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[n+r] AND NOT(D[m+r]);
Exceptions
Undefined Instruction, Hyp Trap.
A8-842 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D op Vn Vd 0 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D op Vn Vd 0 0 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if op == ‘00’ then SEE VEOR;
if op == ‘01’ then operation = VBitOps_VBSL;
if op == ‘10’ then operation = VBitOps_VBIT;
if op == ‘11’ then operation = VBitOps_VBIF;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-843
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}{.<dt>} {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
V<op>{<c>}{<q>}{.<dt>} {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VBIF, VBIT, or VBSL
instruction must be unconditional. ARM strongly recommends that a Thumb VBIF, VBIT, or
VBSL instruction is unconditional, see Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
enumeration VBitOps {VBitOps_VBIF, VBitOps_VBIT, VBitOps_VBSL};
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
case operation of
when VBitOps_VBIF D[d+r] = (D[d+r] AND D[m+r]) OR (D[n+r] AND NOT(D[m+r]));
when VBitOps_VBIT D[d+r] = (D[n+r] AND D[m+r]) OR (D[d+r] AND NOT(D[m+r]));
when VBitOps_VBSL D[d+r] = (D[n+r] AND D[d+r]) OR (D[m+r] AND NOT(D[d+r]));
Exceptions
Undefined Instruction, Hyp Trap.
A8-844 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
int_operation = TRUE; esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 0 sz Vn Vd 1 1 1 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 0 sz Vn Vd 1 1 1 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
int_operation = FALSE; esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-845
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCEQ{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VCEQ{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCEQ instruction must be
unconditional. ARM strongly recommends that a Thumb VCEQ instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
I8 encoding T1/A1, size = 0b00.
I16 encoding T1/A1, size = 0b01.
I32 encoding T1/A1, size = 0b10.
F32 encoding T2/A2, sz = 0.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[D[n+r],e,esize]; op2 = Elem[D[m+r],e,esize];
if int_operation then
test_passed = (op1 == op2);
else
test_passed = FPCompareEQ(op1, op2, FALSE);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-846 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-847
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCEQ{<c>}{<q>}.<dt> {<Qd>,} <Qm>, #0 Encoded as Q = 1
VCEQ{<c>}{<q>}.<dt> {<Dd>,} <Dm>, #0 Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCEQ instruction must be
unconditional. ARM strongly recommends that a Thumb VCEQ instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
I8 encoded as size = 0b00, F = 0.
I16 encoded as size = 0b01, F = 0.
I32 encoded as size = 0b10, F = 0.
F32 encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
test_passed = FPCompareEQ(Elem[D[m+r],e,esize], FPZero(‘0’,esize), FALSE);
else
test_passed = (Elem[D[m+r],e,esize] == Zeros(esize));
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-848 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 0 1 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
type = if U == ‘1’ then VCGEtype_unsigned else VCGEtype_signed;
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D 0 sz Vn Vd 1 1 1 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D 0 sz Vn Vd 1 1 1 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
type = VCGEtype_fp; esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-849
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCGE{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VCGE{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCGE instruction must be
unconditional. ARM strongly recommends that a Thumb VCGE instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
S8 encoding T1/A1, encoded as size = 0b00, U = 0.
S16 encoding T1/A1, encoded as size = 0b01, U = 0.
S32 encoding T1/A1, encoded as size = 0b10, U = 0.
U8 encoding T1/A1, encoded as size = 0b00, U = 1.
U16 encoding T1/A1, encoded as size = 0b01, U = 1.
U32 encoding T1/A1, encoded as size = 0b10, U = 1.
F32 encoding T2/A2, encoded as sz = 0.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
enumeration VCGEtype {VCGEtype_signed, VCGEtype_unsigned, VCGEtype_fp};
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[D[n+r],e,esize]; op2 = Elem[D[m+r],e,esize];
case type of
when VCGEtype_signed test_passed = (SInt(op1) >= SInt(op2));
when VCGEtype_unsigned test_passed = (UInt(op1) >= UInt(op2));
when VCGEtype_fp test_passed = FPCompareGE(op1, op2, FALSE);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Input Denormal, Invalid Operation.
A8-850 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-851
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCGE{<c>}{<q>}.<dt> {<Qd>,} <Qm>, #0 Encoded as Q = 1
VCGE{<c>}{<q>}.<dt> {<Dd>,} <Dm>, #0 Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCGE instruction must be
unconditional. ARM strongly recommends that a Thumb VCGE instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
S8 encoded as size = 0b00, F = 0.
S16 encoded as size = 0b01, F = 0.
S32 encoded as size = 0b10, F = 0.
F32 encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
test_passed = FPCompareGE(Elem[D[m+r],e,esize], FPZero(‘0’,esize), FALSE);
else
test_passed = (SInt(Elem[D[m+r],e,esize]) >= 0);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-852 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 0 1 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
type = if U == ‘1’ then VCGTtype_unsigned else VCGTtype_signed;
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D 1 sz Vn Vd 1 1 1 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D 1 sz Vn Vd 1 1 1 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
type = VCGTtype_fp; esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-853
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCGT{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VCGT{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCGT instruction must be
unconditional. ARM strongly recommends that a Thumb VCGT instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
S8 encoding T1/A1, encoded as size = 0b00, U = 0.
S16 encoding T1/A1, encoded as size = 0b01, U = 0.
S32 encoding T1/A1, encoded as size = 0b10, U = 0.
U8 encoding T1/A1, encoded as size = 0b00, U = 1.
U16 encoding T1/A1, encoded as size = 0b01, U = 1.
U32 encoding T1/A1, encoded as size = 0b10, U = 1.
F32 encoding T2/A2, encoded as sz = 0.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
enumeration VCGTtype {VCGTtype_signed, VCGTtype_unsigned, VCGTtype_fp};
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[D[n+r],e,esize]; op2 = Elem[D[m+r],e,esize];
case type of
when VCGTtype_signed test_passed = (SInt(op1) > SInt(op2));
when VCGTtype_unsigned test_passed = (UInt(op1) > UInt(op2));
when VCGTtype_fp test_passed = FPCompareGT(op1, op2, FALSE);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Input Denormal, Invalid Operation.
A8-854 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 0 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-855
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCGT{<c>}{<q>}.<dt> {<Qd>,} <Qm>, #0 Encoded as Q = 1
VCGT{<c>}{<q>}.<dt> {<Dd>,} <Dm>, #0 Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCGT instruction must be
unconditional. ARM strongly recommends that a Thumb VCGT instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
S8 encoded as size = 0b00, F = 0.
S16 encoded as size = 0b01, F = 0.
S32 encoded as size = 0b10, F = 0.
F32 encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
test_passed = FPCompareGT(Elem[D[m+r],e,esize], FPZero(‘0’,esize), FALSE);
else
test_passed = (SInt(Elem[D[m+r],e,esize]) > 0);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-856 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 0 1 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-857
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCLE{<c>}{<q>}.<dt> {<Qd>,} <Qm>, #0 Encoded as Q = 1
VCLE{<c>}{<q>}.<dt> {<Dd>,} <Dm>, #0 Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCLE instruction must be
unconditional. ARM strongly recommends that a Thumb VCLE instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
S8 encoded as size = 0b00, F = 0.
S16 encoded as size = 0b01, F = 0.
S32 encoded as size = 0b10, F = 0.
F32 encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
test_passed = FPCompareGE(FPZero(‘0’,esize), Elem[D[m+r],e,esize], FALSE);
else
test_passed = (SInt(Elem[D[m+r],e,esize]) <= 0);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-858 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.300 VCLS
Vector Count Leading Sign Bits counts the number of consecutive bits following the topmost bit, that are the same
as the topmost bit, in each element in a vector, and places the results in a second vector. The count does not include
the topmost bit itself.
The operand vector elements can be any one of 8-bit, 16-bit, or 32-bit signed integers.
The result vector elements are the same data type as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-859
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCLS{<c>}{<q>}.<dt> <Qd>, <Qm> Encoded as Q = 1
VCLS{<c>}{<q>}.<dt> <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCLS instruction must be
unconditional. ARM strongly recommends that a Thumb VCLS instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data size for the elements of the operands. It must be one of:
S8 encoded as size = 0b00.
S16 encoded as size = 0b01.
S32 encoded as size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = CountLeadingSignBits(Elem[D[m+r],e,esize])<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-860 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 1 0 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 0 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-861
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCLT{<c>}{<q>}.<dt> {<Qd>,} <Qm>, #0 Encoded as Q = 1
VCLT{<c>}{<q>}.<dt> {<Dd>,} <Dm>, #0 Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCLT instruction must be
unconditional. ARM strongly recommends that a Thumb VCLT instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data types for the elements of the operands. It must be one of:
S8 encoded as size = 0b00, F = 0.
S16 encoded as size = 0b01, F = 0.
S32 encoded as size = 0b10, F = 0.
F32 encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
test_passed = FPCompareGT(FPZero(‘0’,esize), Elem[D[m+r],e,esize], FALSE);
else
test_passed = (SInt(Elem[D[m+r],e,esize]) < 0);
Elem[D[d+r],e,esize] = if test_passed then Ones(esize) else Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-862 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.303 VCLZ
Vector Count Leading Zeros counts the number of consecutive zeros, starting from the most significant bit, in each
element in a vector, and places the results in a second vector.
The operand vector elements can be any one of 8-bit, 16-bit, or 32-bit integers. There is no distinction between
signed and unsigned integers.
The result vector elements are the same data type as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 0 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-863
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCLZ{<c>}{<q>}.<dt> <Qd>, <Qm> Encoded as Q = 1
VCLZ{<c>}{<q>}.<dt> <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCLZ instruction must be
unconditional. ARM strongly recommends that a Thumb VCLZ instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data size for the elements of the operands. It must be one of:
I8 encoded as size = 0b00.
I16 encoded as size = 0b01.
I32 encoded as size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = CountLeadingZeroBits(Elem[D[m+r],e,esize])<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-864 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
Encoding T1/A1 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VCMP{E}<c>.F64 <Dd>, <Dm>
VCMP{E}<c>.F32 <Sd>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 1 0 0 Vd 1 0 1 sz E 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 1 0 0 Vd 1 0 1 sz E 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VCMP{E}<c>.F64 <Dd>, #0.0
VCMP{E}<c>.F32 <Sd>, #0.0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 1 0 1 Vd 1 0 1 sz E 1 (0) 0 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 1 0 1 Vd 1 0 1 sz E 1 (0) 0 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-865
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCMP{E}{<c>}{<q>}.F64 <Dd>, <Dm> Encoding T1/A1, encoded as sz = 1
VCMP{E}{<c>}{<q>}.F32 <Sd>, <Sm> Encoding T1/A1, encoded as sz = 0
VCMP{E}{<c>}{<q>}.F64 <Dd>, #0.0 Encoding T2/A2, encoded as sz = 1
VCMP{E}{<c>}{<q>}.F32 <Sd>, #0.0 Encoding T2/A2, encoded as sz = 0
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if dp_operation then
op64 = if with_zero then FPZero(‘0’,64) else D[m];
(FPSCR.N, FPSCR.Z, FPSCR.C, FPSCR.V) = FPCompare(D[d], op64, quiet_nan_exc, TRUE);
else
op32 = if with_zero then FPZero(‘0’,32) else S[m];
(FPSCR.N, FPSCR.Z, FPSCR.C, FPSCR.V) = FPCompare(S[d], op32, quiet_nan_exc, TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
NaNs
The IEEE 754 standard specifies that the result of a comparison is precisely one of <, ==, > or unordered. If either
or both of the operands are NaNs, they are unordered, and all three of (Operand1 < Operand2),
(Operand1 == Operand2) and (Operand1 > Operand2) are false. This results in the FPSCR flags being set as N=0,
Z=0, C=1 and V=1.
VCMPE raises an Invalid Operation exception if either operand is any type of NaN, and is suitable for testing for <, <=,
>, >=, and other predicates that raise an exception when the operands are unordered.
A8-866 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.305 VCNT
This instruction counts the number of bits that are one in each element in a vector, and places the results in a second
vector.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 0 1 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 1 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-867
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCNT{<c>}{<q>}.8 <Qd>, <Qm> Encoded as Q = 1
VCNT{<c>}{<q>}.8 <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCNT instruction must be
unconditional. ARM strongly recommends that a Thumb VCNT instruction is unconditional,
see Conditional execution on page A8-286.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = BitCount(Elem[D[m+r],e,esize])<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-868 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The vector elements must be 32-bit floating-point numbers, or 32-bit integers. Signed and unsigned integers are
distinct.
The floating-point to integer operation uses the Round towards Zero rounding mode. The integer to floating-point
operation uses the Round to Nearest rounding mode.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 1 Vd 0 1 1 op Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 1 op Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-869
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT{<c>}{<q>}.<Td>.<Tm> <Qd>, <Qm> Encoded as Q = 1
VCVT{<c>}{<q>}.<Td>.<Tm> <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VCVT instruction
must be unconditional. ARM strongly recommends that a Thumb Advanced SIMD VCVT instruction
is unconditional, see Conditional execution on page A8-286.
.<Td>.<Tm> The data types for the elements of the vectors. They must be one of:
.S32.F32 encoded as op = 0b10, size = 0b10.
.U32.F32 encoded as op = 0b11, size = 0b10.
.F32.S32 encoded as op = 0b00, size = 0b10.
.F32.U32 encoded as op = 0b01, size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op = Elem[D[m+r],e,esize];
if to_integer then
result = FPToFixed(op, esize, 0, unsigned, round_zero, FALSE);
else
result = FixedToFP(op, esize, 0, unsigned, round_nearest, FALSE);
Elem[D[d+r],e,esize] = result;
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-870 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The floating-point to integer operation normally uses the Round towards Zero rounding mode, but can optionally
use the rounding mode specified by the FPSCR. The integer to floating-point operation uses the rounding mode
specified by the FPSCR.
VCVT (between floating-point and fixed-point, Floating-point) on page A8-875 describes conversions between
floating-point and 16-bit integers.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
Encoding T1/A1 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VCVT{R}<c>.S32.F64 <Sd>, <Dm>
VCVT{R}<c>.S32.F32 <Sd>, <Sm>
VCVT{R}<c>.U32.F64 <Sd>, <Dm>
VCVT{R}<c>.U32.F32 <Sd>, <Sm>
VCVT<c>.F64.<Tm> <Dd>, <Sm>
VCVT<c>.F32.<Tm> <Sd>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 1 opc2 Vd 1 0 1 sz op 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 1 opc2 Vd 1 0 1 sz op 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-871
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT{R}{<c>}{<q>}.S32.F64 <Sd>, <Dm> Encoded as opc2 = 0b101, sz = 1
VCVT{R}{<c>}{<q>}.S32.F32 <Sd>, <Sm> Encoded as opc2 = 0b101, sz = 0
VCVT{R}{<c>}{<q>}.U32.F64 <Sd>, <Dm> Encoded as opc2 = 0b100, sz = 1
VCVT{R}{<c>}{<q>}.U32.F32 <Sd>, <Sm> Encoded as opc2 = 0b100, sz = 0
VCVT{<c>}{<q>}.F64.<Tm> <Dd>, <Sm> Encoded as opc2 = 0b000, sz = 1
VCVT{<c>}{<q>}.F32.<Tm> <Sd>, <Sm> Encoded as opc2 = 0b000, sz = 0
where:
R If R is specified, the operation uses the rounding mode specified by the FPSCR. Encoded as op = 0.
If R is omitted. the operation uses the Round towards Zero rounding mode. For syntaxes in which R
is optional, op is encoded as 1 if R is omitted.
<Tm> The data type for the operand. It must be one of:
S32 encoded as op = 1
U32 encoded as op = 0.
<Sd>, <Dm> The destination register and the operand register, for a double-precision operand.
<Dd>, <Sm> The destination register and the operand register, for a double-precision result.
<Sd>, <Sm> The destination register and the operand register, for a single-precision operand or result.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if to_integer then
if dp_operation then
S[d] = FPToFixed(D[m], 32, 0, unsigned, round_zero, TRUE);
else
S[d] = FPToFixed(S[m], 32, 0, unsigned, round_zero, TRUE);
else
if dp_operation then
D[d] = FixedToFP(S[m], 64, 0, unsigned, round_nearest, TRUE);
else
S[d] = FixedToFP(S[m], 32, 0, unsigned, round_nearest, TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-872 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The vector elements must be 32-bit floating-point numbers, or 32-bit integers. Signed and unsigned integers are
distinct.
The floating-point to fixed-point operation uses the Round towards Zero rounding mode. The fixed-point to
floating-point operation uses the Round to Nearest rounding mode.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 1 1 1 op 0 Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 1 1 1 op 0 Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-873
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT{<c>}{<q>}.<Td>.<Tm> <Qd>, <Qm>, #<fbits> Encoded as Q = 1
VCVT{<c>}{<q>}.<Td>.<Tm> <Dd>, <Dm>, #<fbits> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VCVT instruction
must be unconditional. ARM strongly recommends that a Thumb Advanced SIMD VCVT instruction
is unconditional, see Conditional execution on page A8-286.
.<Td>.<Tm> The data types for the elements of the vectors. They must be one of:
.S32.F32 encoded as op = 1, U = 0
.U32.F32 encoded as op = 1, U = 1
.F32.S32 encoded as op = 0, U = 0
.F32.U32 encoded as op = 0, U = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
<fbits> The number of fraction bits in the fixed point number, in the range 1 to 32:
• (64 - <fbits>) is encoded in imm6.
An assembler can permit an <fbits> value of 0. This is encoded as floating-point to integer or integer
to floating-point instruction, see VCVT (between floating-point and integer, Advanced SIMD) on
page A8-869.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op = Elem[D[m+r],e,esize];
if to_fixed then
result = FPToFixed(op, esize, frac_bits, unsigned, round_zero, FALSE);
else
result = FixedToFP(op, esize, frac_bits, unsigned, round_nearest, FALSE);
Elem[D[d+r],e,esize] = result;
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-874 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The fixed-point value can be 16-bit or 32-bit. Conversions from fixed-point values take their operand from the
low-order bits of the source register and ignore any remaining bits. Signed conversions to fixed-point values
sign-extend the result value to the destination register width. Unsigned conversions to fixed-point values
zero-extend the result value to the destination register width.
The floating-point to fixed-point operation uses the Round towards Zero rounding mode. The fixed-point to
floating-point operation uses the Round to Nearest rounding mode.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 1 op 1 U Vd 1 0 1 sf sx 1 i 0 imm4
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 1 op 1 U Vd 1 0 1 sf sx 1 i 0 imm4
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-875
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT{<c>}{<q>}.<Td>.F64 <Dd>, <Dd>, #<fbits> Encoded as op = 1, sf = 1
VCVT{<c>}{<q>}.<Td>.F32 <Sd>, <Sd>, #<fbits> Encoded as op = 1, sf = 0
VCVT{<c>}{<q>}.F64.<Td> <Dd>, <Dd>, #<fbits> Encoded as op = 0, sf = 1
VCVT{<c>}{<q>}.F32.<Td> <Sd>, <Sd>, #<fbits> Encoded as op = 0, sf = 0
where:
<Td> The data type for the fixed-point number. It must be one of:
S16 encoded as U = 0, sx = 0
U16 encoded as U = 1, sx = 0
S32 encoded as U = 0, sx = 1
U32 encoded as U = 1, sx = 1.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if to_fixed then
if dp_operation then
result = FPToFixed(D[d], size, frac_bits, unsigned, round_zero, TRUE);
D[d] = if unsigned then ZeroExtend(result, 64) else SignExtend(result, 64);
else
result = FPToFixed(S[d], size, frac_bits, unsigned, round_zero, TRUE);
S[d] = if unsigned then ZeroExtend(result, 32) else SignExtend(result, 32);
else
if dp_operation then
D[d] = FixedToFP(D[d]<size-1:0>, 64, frac_bits, unsigned, round_nearest, TRUE);
else
S[d] = FixedToFP(S[d]<size-1:0>, 32, frac_bits, unsigned, round_nearest, TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-876 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
• converts the value in a double-precision register to single-precision and writes the result to a single-precision
register
• converts the value in a single-precision register to double-precision and writes the result to a double-precision
register.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 1 1 1 Vd 1 0 1 sz 1 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 1 1 1 Vd 1 0 1 sz 1 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-877
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT{<c>}{<q>}.F64.F32 <Dd>, <Sm> Encoded as sz = 0
VCVT{<c>}{<q>}.F32.F64 <Sd>, <Dm> Encoded as sz = 1
where:
<Dd>, <Sm> The destination register and the operand register, for a single-precision operand.
<Sd>, <Dm> The destination register and the operand register, for a double-precision operand.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if double_to_single then
S[d] = FPDoubleToSingle(D[m], TRUE);
else
D[d] = FPSingleToDouble(S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-878 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The vector elements must be 32-bit floating-point numbers, or 16-bit floating-point numbers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
Encoding T1/A1 Advanced SIMD with Half-precision Extension (UNDEFINED in integer-only variant)
VCVT<c>.F32.F16 <Qd>, <Dm>
VCVT<c>.F16.F32 <Dd>, <Qm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 1 1 op 0 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 1 1 op 0 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-879
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT{<c>}{<q>}.F32.F16 <Qd>, <Dm> Encoded as op = 1
VCVT{<c>}{<q>}.F16.F32 <Dd>, <Qm> Encoded as op = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VCVT instruction must be
unconditional. ARM strongly recommends that a Thumb VCVT instruction is unconditional, see
Conditional execution on page A8-286.
<Qd>, <Dm> The destination vector and the operand vector for a half-precision to single-precision operation.
<Dd>, <Qm> The destination vector and the operand vectors for a single-precision to half-precision operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
if half_to_single then
Elem[Q[d>>1],e,2*esize] = FPHalfToSingle(Elem[Din[m],e,esize], FALSE);
else
Elem[D[d],e,esize] = FPSingleToHalf(Elem[Qin[m>>1],e,2*esize], FALSE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-880 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
• convert the half-precision value in the top or bottom half of a single-precision register to single-precision and
write the result to a single-precision register
• convert the value in a single-precision register to half-precision and write the result into the top or bottom
half of a single-precision register, preserving the other half of the target register.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 0 1 op Vd 1 0 1 (0) T 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 0 1 op Vd 1 0 1 (0) T 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-881
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VCVT<y>{<c>}{<q>}.F32.F16 <Sd>, <Sm> Encoded as op = 0
VCVT<y>{<c>}{<q>}.F16.F32 <Sd>, <Sm> Encoded as op = 1
where:
<y> Specifies which half of the operand register <Sm> or destination register <Sd> is used for the operand
or destination. One of:
B Encoded as T = 0.
Instruction uses the bottom half of the register, bits[15:0].
T Encoded as T = 1.
Instruction uses the top half of the register, bits[31:16].
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if half_to_single then
S[d] = FPHalfToSingle(S[m]<lowbit+15:lowbit>, TRUE);
else
S[d]<lowbit+15:lowbit> = FPSingleToHalf(S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-882 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.313 VDIV
This instruction divides one floating-point value by another floating-point value and writes the result to a third
floating-point register.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
Encoding T1/A1 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VDIV<c>.F64 <Dd>, <Dn>, <Dm>
VDIV<c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 0 0 Vn Vd 1 0 1 sz N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 0 0 Vn Vd 1 0 1 sz N 0 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors This instruction can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-883
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VDIV{<c>}{<q>}.F64 {<Dd>,} <Dn>, <Dm> Encoded as sz = 1
VDIV{<c>}{<q>}.F32 {<Sd>,} <Sn>, <Sm> Encoded as sz = 0
where:
<Dd>, <Dn>, <Dm> The destination register and the operand registers, for a double-precision operation.
<Sd>, <Sn>, <Sm> The destination register and the operand registers, for a single-precision operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if dp_operation then
D[d] = FPDiv(D[n], D[m], TRUE);
else
S[d] = FPDiv(S[n], S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-884 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The scalar, and the destination vector elements, can be any one of 8-bit, 16-bit, or 32-bit fields. There is no
distinction between data types.
For more information about scalars see Advanced SIMD scalars on page A7-257.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 imm4 Vd 1 1 0 0 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 imm4 Vd 1 1 0 0 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-885
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VDUP{<c>}{<q>}.<size> <Qd>, <Dm[x]> Encoded as Q = 1
VDUP{<c>}{<q>}.<size> <Dd>, <Dm[x]> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VDUP instruction must be
unconditional. ARM strongly recommends that a Thumb VDUP instruction is unconditional, see
Conditional execution on page A8-286.
<Dm[x]> The scalar. For details of how [x] is encoded, see the description of <size>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
scalar = Elem[D[m],index,esize];
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = scalar;
Exceptions
Undefined Instruction, Hyp Trap.
A8-886 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The destination vector elements can be 8-bit, 16-bit, or 32-bit fields. The source element is the least significant 8,
16, or 32 bits of the ARM core register. There is no distinction between data types.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 B Q 0 Vd Rt 1 0 1 1 D 0 E 1 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 B Q 0 Vd Rt 1 0 1 1 D 0 E 1 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-887
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VDUP{<c>}{<q>}.<size> <Qd>, <Rt> Encoded as Q = 1
VDUP{<c>}{<q>}.<size> <Dd>, <Rt> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. ARM strongly recommends that any VDUP
instruction is unconditional, see Conditional execution on page A8-286.
<size> The data size for the elements of the destination vector. It must be one of:
8 encoded as [b, e] = 0b10.
16 encoded as [b, e] = 0b01.
32 encoded as [b, e] = 0b00.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
scalar = R[t]<esize-1:0>;
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = scalar;
Exceptions
Undefined Instruction, Hyp Trap.
A8-888 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.316 VEOR
Vector Bitwise Exclusive OR performs a bitwise Exclusive OR operation between two registers, and places the
result in the destination register. The operand and result registers can be quadword or doubleword. They must all be
the same size.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D 0 0 Vn Vd 0 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D 0 0 Vn Vd 0 0 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-889
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VEOR{<c>}{<q>}{.<dt>} {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VEOR{<c>}{<q>}{.<dt>} {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VEOR instruction must be
unconditional. ARM strongly recommends that a Thumb VEOR instruction is unconditional,
see Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[n+r] EOR D[m+r];
Exceptions
Undefined Instruction, Hyp Trap.
A8-890 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.317 VEXT
Vector Extract extracts elements from the bottom end of the second operand vector and the top end of the first,
concatenates them and places the result in the destination vector. See Figure A8-1 for an example.
The elements of the vectors are treated as being 8-bit fields. There is no distinction between data types.
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Vm Vn
Vd
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D 1 1 Vn Vd imm4 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D 1 1 Vn Vd imm4 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if Q == ‘0’ && imm4<3> == ‘1’ then UNDEFINED;
quadword_operation = (Q == ‘1’); position = 8 * UInt(imm4);
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-891
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VEXT{<c>}{<q>}.<size> {<Qd>,} <Qn>, <Qm>, #<imm> Encoded as Q = 1
VEXT{<c>}{<q>}.<size> {<Dd>,} <Dn>, <Dm>, #<imm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VEXT instruction must be
unconditional. ARM strongly recommends that a Thumb VEXT instruction is unconditional,
see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<imm> The location of the extracted result in the concatenation of the operands, as a number of
bytes from the least significant end, in the range 0-7 for a doubleword operation or 0-15 for
a quadword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
if quadword_operation then
Q[d>>1] = (Q[m>>1]:Q[n>>1])<position+127:position>;
else
D[d] = (D[m]:D[n])<position+63:position>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-892 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Fused Multiply Subtract negates the elements of one vector and multiplies them with the corresponding
elements of another vector, adds the products to the corresponding elements of the destination vector, and places the
results in the destination vector. The instruction does not round the result of the multiply before the addition.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D op sz Vn Vd 1 1 0 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D op sz Vn Vd 1 1 0 0 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
advsimd = TRUE; op1_neg = (op == ‘1’); esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm);
regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 0 Vn Vd 1 0 1 sz N op M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 0 Vn Vd 1 0 1 sz N op M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-893
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VFM<y><c><q>.F32 <Qd>, <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1, sz = 0
VFM<y><c><q>.F32 <Dd>, <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0, sz = 0
VFM<y><c><q>.F64 <Dd>, <Dn>, <Dm> Encoding T2/A2, encoded as sz = 1
VFM<y><c><q>.F32 <Sd>, <Sn>, <Sm> Encoding T2/A2, encoded as sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VFMA or
VMFS instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VFMA or VMFS instruction is unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Sd>, <Sn>, <Sm> The destination vector and the operand vectors, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[D[n+r],e,esize];
if op1_neg then op1 = FPNeg(op1);
Elem[D[d+r],e,esize] = FPMulAdd(Elem[D[d+r],e,esize],
op1, Elem[D[m+r],e,esize], FALSE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Input Denormal, Invalid Operation, Overflow, Underflow, Inexact.
A8-894 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Fused Negate Multiply Subtract multiplies together two floating-point register values, adds the negation of
the floating-point value in the destination register to the product, and writes the result back to the destination
register. The instruction does not round the result of the multiply before the addition.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-895
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VFNM<y><c><q>.F64 <Dd>, <Dn>, <Dm> Encoding T1/A1, encoded as sz = 1
VFNM<y><c><q>.F32 <Sd>, <Sn>, <Sm> Encoding T1/A1, encoded as sz = 0
where:
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Sd>, <Sn>, <Sm> The destination vector and the operand vectors, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if dp_operation then
op64 = if op1_neg then FPNeg(D[n]) else D[n];
D[d] = FPMulAdd(FPNeg(D[d]), op64, D[m], TRUE);
else
op32 = if op1_neg then FPNeg(S[n]) else S[n];
S[d] = FPMulAdd(FPNeg(S[d]), op32, S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-896 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Halving Subtract subtracts the elements of the second operand from the corresponding elements of the first
operand, shifts each result right one bit, and places the final results in the destination vector. The results of the
halving operations are truncated (there is no rounding version).
The operand and result elements are all the same type, and can be any one of:
• 8-bit, 16-bit, or 32-bit signed integers
• 8-bit, 16-bit, or 32-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 0 op 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 op 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
add = (op == ‘0’); unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-897
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VH<op>{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VH<op>{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VHADD or VHSUB instruction
must be unconditional. ARM strongly recommends that a Thumb VHADD or VHSUB instruction
is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 encoded as size = 0b00, U = 0.
S16 encoded as size = 0b01, U = 0.
S32 encoded as size = 0b10, U = 0.
U8 encoded as size = 0b00, U = 1.
U16 encoded as size = 0b01, U = 1.
U32 encoded as size = 0b10, U = 1.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Int(Elem[D[n+r],e,esize], unsigned);
op2 = Int(Elem[D[m+r],e,esize], unsigned);
result = if add then op1+op2 else op1-op2;
Elem[D[d+r],e,esize] = result<esize:1>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-898 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 1 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd type size align Rm
case type of
when ‘0111’
regs = 1; if align<1> == ‘1’ then UNDEFINED;
when ‘1010’
regs = 2; if align == ‘11’ then UNDEFINED;
when ‘0110’
regs = 3; if align<1> == ‘1’ then UNDEFINED;
when ‘0010’
regs = 4;
otherwise
SEE “Related encodings”;
alignment = if align == ‘00’ then 1 else 4 << UInt(align);
ebytes = 1 << UInt(size); esize = 8 * ebytes; elements = 8 DIV ebytes;
d = UInt(D:Vd); n = UInt(Rn); m = UInt(Rm);
wback = (m != 15); register_index = (m != 15 && m != 13);
if n == 15 || d+regs > 32 then UNPREDICTABLE;
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
Assembler syntax
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD1 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD1 instruction is unconditional, see
Conditional execution on page A8-286.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-899
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
for r = 0 to regs-1
for e = 0 to elements-1
if ebytes != 8 then
data<esize-1:0> = MemU[address,ebytes];
else
if SCTLR.A == ‘1’ && address != Align(address, 8) then AlignmentFault(address, FALSE);
data<31:0> = if BigEndian() then MemU[address+4,4] else MemU[address,4];
data<63:32> = if BigEndian() then MemU[address,4] else MemU[address+4,4];
Elem[D[d+r],e, esize] = data<esize-1:0>;
address = address + ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 8*regs);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-900 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd size 0 0 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 0 index_align Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-901
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD1 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD1 instruction is unconditional, see
Conditional execution on page A8-286.
<list> The register containing the element to load. It must be {<Dd[x]>}. The register <Dd> is encoded in
D:Vd.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Table A8-4 shows the encoding of index and alignment for the different <size> values.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
Elem[D[d], index, esize] = MemU[address, ebytes];
if wback then R[n] = R[n] + (if register_index then R[m] else ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-902 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd 1 1 0 0 size T a Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd 1 1 0 0 size T a Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-903
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD1{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD1 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD1 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
replicated_element = Replicate(MemU[address,ebytes], elements);
if wback then R[n] = R[n] + (if register_index then R[m] else ebytes);
for r = 0 to regs-1
D[d+r] = replicated_element;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-904 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 1 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd type size align Rm
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-905
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD2 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD2 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r], e, esize] = MemU[address, ebytes];
Elem[D[d2+r], e, esize] = MemU[address+ebytes, ebytes];
address = address + 2*ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 16*regs);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-906 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd size 0 1 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 0 1 index_align Rm
if size == ‘11’ then SEE VLD2 (single 2-element structure to all lanes);
case size of
when ‘00’
ebytes = 1; esize = 8; index = UInt(index_align<3:1>); inc = 1;
alignment = if index_align<0> == ‘0’ then 1 else 2;
when ‘01’
ebytes = 2; esize = 16; index = UInt(index_align<3:2>);
inc = if index_align<1> == ‘0’ then 1 else 2;
alignment = if index_align<0> == ‘0’ then 1 else 4;
when ‘10’
if index_align<1> != ‘0’ then UNDEFINED;
ebytes = 4; esize = 32; index = UInt(index_align<3>);
inc = if index_align<2> == ‘0’ then 1 else 2;
alignment = if index_align<0> == ‘0’ then 1 else 8;
d = UInt(D:Vd); d2 = d + inc; n = UInt(Rn); m = UInt(Rm);
wback = (m != 15); register_index = (m != 15 && m != 13);
if n == 15 || d2 > 31 then UNPREDICTABLE;
Assembler syntax
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD2 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD2 instruction is unconditional, see
Conditional execution on page A8-286.
<list> The registers containing the structure. Encoded with D:Vd = <Dd>. It must be one of:
{<Dd[x]>, <Dd+1[x]>} Single-spaced registers, see Table A8-5 on page A8-908.
{<Dd[x]>, <Dd+2[x]>} Double-spaced registers, see Table A8-5 on page A8-908.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-907
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about <Rn>, !, and <Rm> see Advanced SIMD addressing mode on page A7-275.
<align> == 16 index_align[0] = 1 - -
<align> == 32 - index_align[0] = 1 -
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
Elem[D[d], index, esize] = MemU[address, ebytes];
Elem[D[d2], index, esize] = MemU[address+ebytes, ebytes];
if wback then R[n] = R[n] + (if register_index then R[m] else 2*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-908 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd 1 1 0 1 size T a Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd 1 1 0 1 size T a Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-909
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD2{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD2 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD2 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
D[d] = Replicate(MemU[address, ebytes], elements);
D[d2] = Replicate(MemU[address+ebytes, ebytes], elements);
if wback then R[n] = R[n] + (if register_index then R[m] else 2*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-910 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 1 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd type size align Rm
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-911
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD3{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD3{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD3{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD3 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD3 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
for e = 0 to elements-1
Elem[D[d], e, esize] = MemU[address, ebytes];
Elem[D[d2], e, esize] = MemU[address+ebytes, ebytes];
Elem[D[d3], e, esize] = MemU[address+2*ebytes, ebytes];
address = address + 3*ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 24);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-912 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd size 1 0 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 1 0 index_align Rm
if size == ‘11’ then SEE VLD3 (single 3-element structure to all lanes);
case size of
when ‘00’
if index_align<0> != ‘0’ then UNDEFINED;
ebytes = 1; esize = 8; index = UInt(index_align<3:1>); inc = 1;
when ‘01’
if index_align<0> != ‘0’ then UNDEFINED;
ebytes = 2; esize = 16; index = UInt(index_align<3:2>);
inc = if index_align<1> == ‘0’ then 1 else 2;
when ‘10’
if index_align<1:0> != ‘00’ then UNDEFINED;
ebytes = 4; esize = 32; index = UInt(index_align<3>);
inc = if index_align<2> == ‘0’ then 1 else 2;
d = UInt(D:Vd); d2 = d + inc; d3 = d2 + inc; n = UInt(Rn); m = UInt(Rm);
wback = (m != 15); register_index = (m != 15 && m != 13);
if n == 15 || d3 > 31 then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-913
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD3{<c>}{<q>}.<size> <list>, [<Rn>] Encoded as Rm = 0b1111
VLD3{<c>}{<q>}.<size> <list>, [<Rn>]! Encoded as Rm = 0b1101
VLD3{<c>}{<q>}.<size> <list>, [<Rn>], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD3 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD3 instruction is unconditional, see
Conditional execution on page A8-286.
<list> The registers containing the structure. Encoded with D:Vd = <Dd>. It must be one of:
{<Dd[x]>, <Dd+1[x]>, <Dd+2[x]>}
Single-spaced registers, see Table A8-6.
{<Dd[x]>, <Dd+2[x]>, <Dd+4[x]>}
Double-spaced registers, see Table A8-6.
This is not available if <size> == 8.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Alignment
Standard alignment rules apply, see Unaligned data access on page A3-106.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n];
Elem[D[d], index, esize] = MemU[address, ebytes];
Elem[D[d2], index, esize] = MemU[address+ebytes, ebytes];
Elem[D[d3], index, esize] = MemU[address+2*ebytes, ebytes];
if wback then R[n] = R[n] + (if register_index then R[m] else 3*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-914 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd 1 1 1 0 size T a Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd 1 1 1 0 size T a Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-915
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD3{<c>}{<q>}.<size> <list>, [<Rn>] Encoded as Rm = 0b1111
VLD3{<c>}{<q>}.<size> <list>, [<Rn>]! Encoded as Rm = 0b1101
VLD3{<c>}{<q>}.<size> <list>, [<Rn>], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD3 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD3 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Alignment
Standard alignment rules apply, see Unaligned data access on page A3-106.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n];
D[d] = Replicate(MemU[address, ebytes], elelments);
D[d2] = Replicate(MemU[address+ebytes, ebytes], elements);
D[d3] = Replicate(MemU[address+2*ebytes, ebytes], elements);
if wback then R[n] = R[n] + (if register_index then R[m] else 3*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-916 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 1 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 1 0 Rn Vd type size align Rm
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-917
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD4 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD4 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
for e = 0 to elements-1
Elem[D[d], e, esize] = MemU[address, ebytes];
Elem[D[d2], e, esize] = MemU[address+ebytes, ebytes];
Elem[D[d3], e, esize] = MemU[address+2*ebytes, ebytes];
Elem[D[d4], e, esize] = MemU[address+3*ebytes, ebytes];
address = address + 4*ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 32);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-918 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd size 1 1 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd size 1 1 index_align Rm
if size == ‘11’ then SEE VLD4 (single 4-element structure to all lanes);
case size of
when ‘00’
ebytes = 1; esize = 8; index = UInt(index_align<3:1>); inc = 1;
alignment = if index_align<0> == ‘0’ then 1 else 4;
when ‘01’
ebytes = 2; esize = 16; index = UInt(index_align<3:2>);
inc = if index_align<1> == ‘0’ then 1 else 2;
alignment = if index_align<0> == ‘0’ then 1 else 8;
when ‘10’
if index_align<1:0> == ‘11’ then UNDEFINED;
ebytes = 4; esize = 32; index = UInt(index_align<3>);
inc = if index_align<2> == ‘0’ then 1 else 2;
alignment = if index_align<1:0> == ‘00’ then 1 else 4 << UInt(index_align<1:0>);
d = UInt(D:Vd); d2 = d + inc; d3 = d2 + inc; d4 = d3 + inc; n = UInt(Rn); m = UInt(Rm);
wback = (m != 15); register_index = (m != 15 && m != 13);
if n == 15 || d4 > 31 then UNPREDICTABLE;
Assembler syntax
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}] Encoded as Rm = 0b1111
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}]! Encoded as Rm = 0b1101
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{:<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD4 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD4 instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size. It must be one of:
8 encoded as size = 0b00.
16 encoded as size = 0b01.
32 encoded as size = 0b10.
<list> The registers containing the structure. Encoded with D:Vd = <Dd>. It must be one of:
{<Dd[x]>, <Dd+1[x]>, <Dd+2[x]>, <Dd+3[x]>}
Single-spaced registers, see Table A8-7 on page A8-920.
{<Dd[x]>, <Dd+2[x]>, <Dd+4[x]>, <Dd+6[x]>}
Double-spaced registers, see Table A8-7 on page A8-920.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-919
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about <Rn>, !, and <Rm> see Advanced SIMD addressing mode on page A7-275.
<align> == 32 index_align[0] = 1 - -
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
Elem[D[d], index, esize] = MemU[address, ebytes];
Elem[D[d2], index, esize] = MemU[address+ebytes, ebytes];
Elem[D[d3], index, esize] = MemU[address+2*ebytes, ebytes];
Elem[D[d4], index, esize] = MemU[address+3*ebytes, ebytes];
if wback then R[n] = R[n] + (if register_index then R[m] else 4*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-920 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 1 0 Rn Vd 1 1 1 1 size T a Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 1 0 Rn Vd 1 1 1 1 size T a Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-921
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{ :<align>}] Encoded as Rm = 0b1111
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{ :<align>}]! Encoded as Rm = 0b1101
VLD4{<c>}{<q>}.<size> <list>, [<Rn>{ :<align>}], <Rm> Rm cannot be 0b11x1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VLD4 instruction must be
unconditional. ARM strongly recommends that a Thumb VLD4 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, FALSE);
D[d] = Replicate(MemU[address, ebytes], elements);
D[d2] = Replicate(MemU[address+ebytes, ebytes], elements);
D[d3] = Replicate(MemU[address+2*ebytes, ebytes], elements);
D[d4] = Replicate(MemU[address+3*ebytes, ebytes], elements);
if wback then R[n] = R[n] + (if register_index then R[m] else 4*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-922 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.333 VLDM
Vector Load Multiple loads multiple extension registers from consecutive memory locations using an address from
an ARM core register.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 1 Rn Vd 1 0 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 1 Rn Vd 1 0 1 1 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 1 Rn Vd 1 0 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 1 Rn Vd 1 0 1 0 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Related encodings See 64-bit transfers between ARM core and extension registers on page A7-277.
FLDMX Encoding T1/A1 behaves as described by the pseudocode if imm8 is odd. However,
there is no UAL syntax for such encodings and ARM deprecates their use. For more
information, see FLDMX, FSTMX on page A8-389.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-923
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLDM{<mode>}{<c>}{<q>}{.<size>} <Rn>{!}, <list>
where:
<size> An optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers
in <list>.
<Rn> The base register. The SP can be used. In the ARM instruction set, if ! is not specified the PC can
be used, but ARM deprecates this use of the PC.
! Causes the instruction to write a modified value back to <Rn>. This is required if <mode> == DB, and
is optional if <mode> == IA. Encoded as W = 1.
If ! is omitted, the instruction does not change <Rn> in this way. Encoded as W = 0.
<list> The extension registers to be loaded, as a list of consecutively numbered doubleword (encoding
T1/A1) or singleword (encoding T2/A2) registers, separated by commas and surrounded by
brackets. It is encoded in the instruction by setting D and Vd to specify the first register in the list,
and imm8 to twice the number of registers in the list (encoding T1/A1) or the number of registers
in the list (encoding T2/A2). <list> must contain at least one register. If it contains doubleword
registers it must not contain more than 16 registers.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(n);
address = if add then R[n] else R[n]-imm32;
for r = 0 to regs-1
if single_regs then
S[d+r] = MemA[address,4]; address = address+4;
else
word1 = MemA[address,4]; word2 = MemA[address+4,4]; address = address+8;
// Combine the word-aligned words in the correct order for current endianness.
D[d+r] = if BigEndian() then word1:word2 else word2:word1;
if wback then R[n] = if add then R[n]+imm32 else R[n]-imm32;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-924 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.334 VLDR
This instruction loads a single extension register from memory, using an address from an ARM core register, with
an optional offset.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 U D 0 1 Rn Vd 1 0 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 1 U D 0 1 Rn Vd 1 0 1 1 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 U D 0 1 Rn Vd 1 0 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 1 U D 0 1 Rn Vd 1 0 1 0 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-925
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VLDR{<c>}{<q>}{.64} <Dd>, [<Rn> {, #+/-<imm>}] Encoding T1/A1, immediate form
VLDR{<c>}{<q>}{.64} <Dd>, <label> Encoding T1/A1, normal literal form
VLDR{<c>}{<q>}{.64} <Dd>, [PC, #+/-<imm>] Encoding T1/A1, alternative literal form
VLDR{<c>}{<q>}{.32} <Sd>, [<Rn> {, #+/-<imm>}] Encoding T2/A2, immediate form
VLDR{<c>}{<q>}{.32} <Sd>, <label> Encoding T2/A2, normal literal form
VLDR{<c>}{<q>}{.32} <Sd>, [PC, #+/-<imm>] Encoding T2/A2, alternative literal form
where:
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. For the immediate forms of the syntax, <imm>
can be omitted, in which case the #0 form of the instruction is assembled. Permitted values are
multiples of 4 in the range 0 to 1020.
<label> The label of the literal data item to be loaded. The assembler calculates the required value of the
offset from the Align(PC, 4) value of the instruction to this label. Permitted values are multiples of
4 in the range -1020 to 1020.
If the offset is zero or positive, imm32 is equal to the offset and add == TRUE.
If the offset is negative, imm32 is equal to minus the offset and add == FALSE.
For the literal forms of the instruction, the base register is encoded as 0b1111 to indicate that the PC is the base
register.
The alternative syntax permits the addition or subtraction of the offset and the immediate offset to be specified
separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more
information, see Use of labels in UAL instruction syntax on page A4-160.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(n);
base = if n == 15 then Align(PC,4) else R[n];
address = if add then (base + imm32) else (base - imm32);
if single_reg then
S[d] = MemA[address,4];
else
word1 = MemA[address,4]; word2 = MemA[address+4,4];
// Combine the word-aligned words in the correct order for current endianness.
D[d] = if BigEndian() then word1:word2 else word2:word1;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-926 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Minimum compares corresponding elements in two vectors, and copies the smaller of each pair into the
corresponding element in the destination vector.
The result vector elements are the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 1 0 N Q M op Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 1 0 N Q M op Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
maximum = (op == ‘0’); unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-927
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
V<op>{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VMAX or VMIN instruction
must be unconditional. ARM strongly recommends that a Thumb VMAX or VMIN instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data types for the elements of the vectors. It must be one of:
S8 encoded as size = 0b00, U = 0.
S16 encoded as size = 0b01, U = 0.
S32 encoded as size = 0b10, U = 0.
U8 encoded as size = 0b00, U = 1.
U16 encoded as size = 0b01, U = 1.
U32 encoded as size = 0b10, U = 1.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Int(Elem[D[n+r],e,esize], unsigned);
op2 = Int(Elem[D[m+r],e,esize], unsigned);
result = if maximum then Max(op1,op2) else Min(op1,op2);
Elem[D[d+r],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-928 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Minimum compares corresponding elements in two vectors, and copies the smaller of each pair into the
corresponding element in the destination vector.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D op sz Vn Vd 1 1 1 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D op sz Vn Vd 1 1 1 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
maximum = (op == ‘0’); esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-929
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}.F32 {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
V<op>{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VMAX or VMIN instruction
must be unconditional. ARM strongly recommends that a Thumb VMAX or VMIN instruction is
unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[D[n+r],e,esize]; op2 = Elem[D[m+r],e,esize];
Elem[D[d+r],e,esize] = if maximum then FPMax(op1,op2,FALSE) else FPMin(op1,op2,FALSE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-930 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 op 1 1 1 1 0 D size Vn Vd 1 0 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 op 0 D size Vn Vd 1 0 0 1 N Q M 0 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 1 0 op 0 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 1 0 op 0 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-931
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}.<type><size> <Qd>, <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1
V<op>{<c>}{<q>}.<type><size> <Dd>, <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0
V<op>L{<c>}{<q>}.<type><size> <Qd>, <Dn>, <Dm> Encoding T2/A2
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMLA,
VMLAL, VMLS, or VMLSL instruction must be unconditional. ARM strongly recommends that a
Thumb Advanced SIMD VMLA, VMLAL, VMLS, or VMLSL instruction is unconditional, see
Conditional execution on page A8-286.
<type> The data type for the elements of the operands. It must be one of:
S Optional in encoding T1/A1. Encoded as U = 0 in encoding T2/A2.
U Optional in encoding T1/A1. Encoded as U = 1 in encoding T2/A2.
I Available only in encoding T1/A1.
<size> The data size for the elements of the operands. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Qd>, <Dn>, <Dm> The destination vector and the operand vectors, for a long operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
product = Int(Elem[Din[n+r],e,esize],unsigned) * Int(Elem[Din[m+r],e,esize],unsigned);
addend = if add then product else -product;
if long_destination then
Elem[Q[d>>1],e,2*esize] = Elem[Qin[d>>1],e,2*esize] + addend;
else
Elem[D[d+r],e,esize] = Elem[Din[d+r],e,esize] + addend;
Exceptions
Undefined Instruction, Hyp Trap.
A8-932 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Multiply Subtract multiplies corresponding elements in two vectors, subtracts the products from
corresponding elements of the destination vector, and places the results in the destination vector.
Note
ARM recommends that software does not use the VMLS instruction in the Round towards Plus Infinity and Round
towards Minus Infinity rounding modes, because the rounding of the product and of the sum can change the result
of the instruction in opposite directions, defeating the purpose of these rounding modes.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D op sz Vn Vd 1 1 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D op sz Vn Vd 1 1 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
advsimd = TRUE; add = (op == ‘0’); esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
V<op><c>.F64 <Dd>, <Dn>, <Dm>
V<op><c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 D 0 0 Vn Vd 1 0 1 sz N op M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 D 0 0 Vn Vd 1 0 1 sz N op M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-933
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}.F32 <Qd>, <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1, sz = 0
V<op>{<c>}{<q>}.F32 <Dd>, <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0, sz = 0
V<op>{<c>}{<q>}.F64 <Dd>, <Dn>, <Dm> Encoding T2/A2, encoded as sz = 1
V<op>{<c>}{<q>}.F32 <Sd>, <Sn>, <Sm> Encoding T2/A2, encoded as sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMLA or
VMLS instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VMLA or VMLS instruction is unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Sd>, <Sn>, <Sm> The destination vector and the operand vectors, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
product = FPMul(Elem[D[n+r],e,esize], Elem[D[m+r],e,esize], FALSE);
addend = if add then product else FPNeg(product);
Elem[D[d+r],e,esize] = FPAdd(Elem[D[d+r],e,esize], addend, FALSE);
else // VFP instruction
if dp_operation then
addend64 = if add then FPMul(D[n], D[m], TRUE) else FPNeg(FPMul(D[n], D[m], TRUE));
D[d] = FPAdd(D[d], addend64, TRUE);
else
addend32 = if add then FPMul(S[n], S[m], TRUE) else FPNeg(FPMul(S[n], S[m], TRUE));
S[d] = FPAdd(S[d], addend32, TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-934 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about scalars see Advanced SIMD scalars on page A7-257.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 Q 1 1 1 1 1 D size Vn Vd 0 op 0 F N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 Q 1 D size Vn Vd 0 op 0 F N 1 M 0 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 0 op 1 0 N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 0 op 1 0 N 1 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-935
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
V<op>{<c>}{<q>}.<type><size> <Qd>, <Qn>, <Dm[x]> Encoding T1/A1, encoded as Q = 1
V<op>{<c>}{<q>}.<type><size> <Dd>, <Dn>, <Dm[x]> Encoding T1/A1, encoded as Q = 0
V<op>L{<c>}{<q>}.<type><size> <Qd>, <Dn>, <Dm[x]> Encoding T2/A2
where:
<op> The operation. It must be one of:
MLA Vector Multiply Accumulate. Encoded as op = 0.
MLS Vector Multiply Subtract. Encoded as op = 1.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMLA, VMLAL, VMLS,
or VMLSL instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VMLA, VMLAL, VMLS, or VMLSL instruction is unconditional, see Conditional execution on
page A8-286.
<type> The data type for the elements of the operands. It must be one of:
S Encoding T2/A2, encoded as U = 0.
U Encoding T2/A2, encoded as U = 1.
I Encoding T1/A1, encoded as F = 0.
F Encoding T1/A1, encoded as F = 1. <size> must be 32.
<size> The operand element data size. It can be:
16 Encoded as size = 01.
32 Encoded as size = 10.
<Qd>, <Qn> The accumulate vector, and the operand vector, for a quadword operation.
<Dd>, <Dn> The accumulate vector, and the operand vector, for a doubleword operation.
<Qd>, <Dn> The accumulate vector, and the operand vector, for a long operation.
<Dm[x]> The scalar. Dm is restricted to D0-D7 if <size> is 16, or D0-D15 otherwise.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
op2 = Elem[Din[m],index,esize]; op2val = Int(op2, unsigned);
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[Din[n+r],e,esize]; op1val = Int(op1, unsigned);
if floating_point then
fp_addend = if add then FPMul(op1,op2,FALSE) else FPNeg(FPMul(op1,op2,FALSE));
Elem[D[d+r],e,esize] = FPAdd(Elem[Din[d+r],e,esize], fp_addend, FALSE);
else
addend = if add then op1val*op2val else -op1val*op2val;
if long_destination then
Elem[Q[d>>1],e,2*esize] = Elem[Qin[d>>1],e,2*esize] + addend;
else
Elem[D[d+r],e,esize] = Elem[Din[d+r],e,esize] + addend;
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-936 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 i 1 1 1 1 1 D 0 0 0 imm3 Vd cmode 0 Q op 1 imm4
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode 0 Q op 1 imm4
if op == ‘0’ && cmode<0> == ‘1’ && cmode<3:2> != ‘11’ then SEE VORR (immediate);
if op == ‘1’ && cmode != ‘1110’ then SEE “Related encodings”;
if Q == ‘1’ && Vd<0> == ‘1’ then UNDEFINED;
single_register = FALSE; advsimd = TRUE; imm64 = AdvSIMDExpandImm(op, cmode, i:imm3:imm4);
d = UInt(D:Vd); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 imm4H Vd 1 0 1 sz (0) 0 (0) 0 imm4L
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 imm4H Vd 1 0 1 sz (0) 0 (0) 0 imm4L
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Related encodings See One register and a modified immediate value on page A7-267.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride}
fields. For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-937
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>}.<dt> <Qd>, #<imm> Encoding T1/A1, encoded as Q = 1
VMOV{<c>}{<q>}.<dt> <Dd>, #<imm> Encoding T1/A1, encoded as Q = 0
VMOV{<c>}{<q>}.F64 <Dd>, #<imm> Encoding T2/A2, encoded as sz = 1
VMOV{<c>}{<q>}.F32 <Sd>, #<imm> Encoding T2/A2, encoded as sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMOV (immediate)
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced SIMD VMOV
(immediate) instruction is unconditional, see Conditional execution on page A8-286.
<dt> The data type. It must be one of I8, I16, I32, I64, or F32.
<imm> A constant of the type specified by <dt>. This constant is replicated enough times to fill the
destination register. For example, VMOV.I32 D0, #10 writes 0x0000000A0000000A to D0.
For the range of constants available, and the encoding of <dt> and <imm>, see:
• One register and a modified immediate value on page A7-267 for encoding T1/A1
• Floating-point data-processing instructions on page A7-270 for encoding T2/A2.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if single_register then
S[d] = imm32;
else
for r = 0 to regs-1
D[d+r] = imm64;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
One register and a modified immediate value on page A7-267 describes pseudo-instructions with a combination of
<dt> and <imm> that is not supported by hardware, but that generates the same destination register value as a different
combination that is supported by hardware.
A8-938 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 1 0 Vm Vd 0 0 0 1 M Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 1 0 Vm Vd 0 0 0 1 M Q M 1 Vm
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VMOV<c>.F64 <Dd>, <Dm>
VMOV<c>.F32 <Sd>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 0 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 0 0 0 Vd 1 0 1 sz 0 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-939
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>}{.<dt>} <Qd>, <Qm> Encoding T1/A1, encoded as Q = 1
VMOV{<c>}{<q>}{.<dt>} <Dd>, <Dm> Encoding T1/A1, encoded as Q = 0
VMOV{<c>}{<q>}.F64 <Dd>, <Dm> Encoding T2/A2, encoded as sz = 1
VMOV{<c>}{<q>}.F32 <Sd>, <Sm> Encoding T2/A2, encoded as sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMOV
(register) instruction must be unconditional. ARM strongly recommends that a Thumb
Advanced SIMD VMOV (register) instruction is unconditional, see Conditional execution on
page A8-286.
<dt> An optional data type. <dt> must not be F64, but it is otherwise ignored.
<Qd>, <Qm> The destination register and the source register, for a quadword operation.
<Dd>, <Dm> The destination register and the source register, for a doubleword operation.
<Sd>, <Sm> The destination register and the source register, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if single_register then
S[d] = S[m];
else
for r = 0 to regs-1
D[d+r] = D[m+r];
Exceptions
Undefined Instruction, Hyp Trap.
A8-940 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
On a Floating-point-only system, this instruction transfers one word to the upper or lower half of a double-precision
floating-point register from an ARM core register. This is an identical operation to the Advanced SIMD single word
transfer.
For more information about scalars see Advanced SIMD scalars on page A7-257.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
Encoding T1/A1 Word version (opc1:opc2 == '0x00'): VFPv2, VFPv3, VFPv4, Advanced SIMD
Advanced SIMD otherwise
VMOV<c>.<size> <Dd[x]>, <Rt>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 opc1 0 Vd Rt 1 0 1 1 D opc2 1 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 opc1 0 Vd Rt 1 0 1 1 D opc2 1 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
case opc1:opc2 of
when “1xxx” advsimd = TRUE; esize = 8; index = UInt(opc1<0>:opc2);
when “0xx1” advsimd = TRUE; esize = 16; index = UInt(opc1<0>:opc2<1>);
when “0x00” advsimd = FALSE; esize = 32; index = UInt(opc1<0>);
when “0x10” UNDEFINED;
d = UInt(D:Vd); t = UInt(Rt);
if t == 15 || (CurrentInstrSet() != InstrSet_ARM && t == 13) then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-941
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>}{.<size>} <Dd[x]>, <Rt>
where:
<Dd[x]> The scalar. The register <Dd> is encoded in D:Vd. For details of how [x] is encoded, see the
description of <size>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
Elem[D[d],index,esize] = R[t]<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-942 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
On a Floating-point-only system, this instruction transfers one word from the upper or lower half of a
double-precision floating-point register to an ARM core register. This is an identical operation to the Advanced
SIMD single word transfer.
For more information about scalars see Advanced SIMD scalars on page A7-257.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
Encoding T1/A1 Word version (U:opc1:opc2 == '00x00'): VFPv2, VFPv3, VFPv4, Advanced SIMD
Advanced SIMD otherwise
VMOV<c>.<dt> <Rt>, <Dn[x]>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 U opc1 1 Vn Rt 1 0 1 1 N opc2 1 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 U opc1 1 Vn Rt 1 0 1 1 N opc2 1 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
case U:opc1:opc2 of
when “x1xxx” advsimd = TRUE; esize = 8; index = UInt(opc1<0>:opc2);
when “x0xx1” advsimd = TRUE; esize = 16; index = UInt(opc1<0>:opc2<1>);
when “00x00” advsimd = FALSE; esize = 32; index = UInt(opc1<0>);
when “10x00” UNDEFINED;
when “x0x10” UNDEFINED;
t = UInt(Rt); n = UInt(N:Vn); unsigned = (U == ‘1’);
if t == 15 || (CurrentInstrSet() != InstrSet_ARM && t == 13) then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-943
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>}{.<dt>} <Rt>, <Dn[x]>
where:
<Dn[x]> The scalar. For details of how [x] is encoded see the description of <dt>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if unsigned then
R[t] = ZeroExtend(Elem[D[n],index,esize], 32);
else
R[t] = SignExtend(Elem[D[n],index,esize], 32);
Exceptions
Undefined Instruction, Hyp Trap.
A8-944 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 0 0 op Vn Rt 1 0 1 0 N (0) (0) 1 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 0 0 op Vn Rt 1 0 1 0 N (0) (0) 1 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-945
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>} <Sn>, <Rt> Encoded as op = 0
VMOV{<c>}{<q>} <Rt>, <Sn> Encoded as op = 1
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if to_arm_register then
R[t] = S[n];
else
S[n] = R[t];
Exceptions
Undefined Instruction, Hyp Trap.
A8-946 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.345 VMOV (between two ARM core registers and two single-precision registers)
This instruction transfers the contents of two consecutively numbered single-precision Floating-point registers to
two ARM core registers, or the contents of two ARM core registers to a pair of single-precision Floating-point
registers. The ARM core registers do not have to be contiguous.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 0 1 0 op Rt2 Rt 1 0 1 0 0 0 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 0 1 0 op Rt2 Rt 1 0 1 0 0 0 M 1 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-947
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>} <Sm>, <Sm1>, <Rt>, <Rt2> Encoded as op = 0
VMOV{<c>}{<q>} <Rt>, <Rt2>, <Sm>, <Sm1> Encoded as op = 1
where:
<Sm1> The second single-precision Floating-point register. This is the next single-precision Floating-point
register after <Sm>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if to_arm_registers then
R[t] = S[m];
R[t2] = S[m+1];
else
S[m] = R[t];
S[m+1] = R[t2];
Exceptions
Undefined Instruction, Hyp Trap.
A8-948 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.346 VMOV (between two ARM core registers and a doubleword extension register)
This instruction copies two words from two ARM core registers into a doubleword extension register, or from a
doubleword extension register to two ARM core registers.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 0 1 0 op Rt2 Rt 1 0 1 1 0 0 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 0 1 0 op Rt2 Rt 1 0 1 1 0 0 M 1 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-949
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOV{<c>}{<q>} <Dm>, <Rt>, <Rt2> Encoded as op = 0
VMOV{<c>}{<q>} <Rt>, <Rt2>, <Dm> Encoded as op = 1
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if to_arm_registers then
R[t] = D[m]<31:0>;
R[t2] = D[m]<63:32>;
else
D[m]<31:0> = R[t];
D[m]<63:32> = R[t2];
Exceptions
Undefined Instruction, Hyp Trap.
A8-950 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.347 VMOVL
Vector Move Long takes each element in a doubleword vector, sign or zero-extends them to twice their original
length, and places the results in a quadword vector.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm3 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm3 0 0 0 Vd 1 0 1 0 0 0 M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-951
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOVL{<c>}{<q>}.dt> <Qd>, <Dm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VMOVL instruction must be
unconditional. ARM strongly recommends that a Thumb VMOVL instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the operand. It must be one of:
S8 Encoded as U = 0, imm3 = 0b001.
S16 Encoded as U = 0, imm3 = 0b010.
S32 Encoded as U = 0, imm3 = 0b100.
U8 Encoded as U = 1, imm3 = 0b001.
U16 Encoded as U = 1, imm3 = 0b010.
U32 Encoded as U = 1, imm3 = 0b100.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
result = Int(Elem[Din[m],e,esize], unsigned);
Elem[Q[d>>1],e,2*esize] = result<2*esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-952 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.348 VMOVN
Vector Move and Narrow copies the least significant half of each element of a quadword vector into the
corresponding elements of a doubleword vector.
The operand vector elements can be any one of 16-bit, 32-bit, or 64-bit integers. There is no distinction between
signed and unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 0 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 0 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-953
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMOVN{<c>}{<q>}.<dt> <Dd>, <Qm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VMOVN instruction must be
unconditional. ARM strongly recommends that a Thumb VMOVN instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the operand. It must be one of:
I16 Encoded as size = 0b00.
I32 Encoded as size = 0b01.
I64 Encoded as size = 0b10.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
Elem[D[d],e,esize] = Elem[Qin[m>>1],e,2*esize]<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-954 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.349 VMRS
Move to ARM core register from Advanced SIMD and Floating-point Extension System Register moves the value
of the FPSCR to an ARM core register.
For details of system level use of this instruction, see VMRS on page B9-2000.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 1 1 1 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 1 1 1 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
t = UInt(Rt);
if t == 13 && CurrentInstrSet() != InstrSet_ARM then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-955
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMRS{<c>}{<q>} <Rt>, FPSCR
where:
<Rt> The destination ARM core register. This register can be R0-R14 or APSR_nzcv. APSR_nzcv is
encoded as Rt = 0b1111, and the instruction transfers the FPSCR.{N, Z, C, V} condition flags to the
APSR.{N, Z, C, V} condition flags.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
SerializeVFP(); VFPExcBarrier();
if t != 15 then
R[t] = FPSCR;
else
APSR.N = FPSCR.N;
APSR.Z = FPSCR.Z;
APSR.C = FPSCR.C;
APSR.V = FPSCR.V;
Exceptions
Undefined Instruction, Hyp Trap.
A8-956 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.350 VMSR
Move to Advanced SIMD and Floating-point Extension System Register from ARM core register moves the value
of an ARM core register to the FPSCR.
For details of system level use of this instruction, see VMSR on page B9-2002.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 1 1 0 0 0 0 1 Rt 1 0 1 0 (0) (0) (0) 1 (0) (0) (0) (0)
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
t = UInt(Rt);
if t == 15 || (t == 13 && CurrentInstrSet() != InstrSet_ARM) then UNPREDICTABLE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-957
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMSR{<c>}{<q>} FPSCR, <Rt>
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
SerializeVFP(); VFPExcBarrier();
FPSCR = R[t];
Exceptions
Undefined Instruction, Hyp Trap.
A8-958 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For information about multiplying polynomials see Polynomial arithmetic over {0, 1} on page A2-92.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 op 1 1 1 1 0 D size Vn Vd 1 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 op 0 D size Vn Vd 1 0 0 1 N Q M 1 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 1 1 op 0 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 1 1 op 0 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-959
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMUL{<c>}{<q>}.<type><size> {<Qd>,} <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1
VMUL{<c>}{<q>}.<type><size> {<Dd>,} <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0
VMULL{<c>}{<q>}.<type><size> <Qd>, <Dn>, <Dm> Encoding T2/A2
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMUL or
VMULL instruction must be unconditional. ARM strongly recommends that a Thumb
Advanced SIMD VMUL or VMULL instruction is unconditional, see Conditional execution on
page A8-286.
<type> The data type for the elements of the operands. It must be one of:
S Encoded as op = 0 in both encodings, with U = 0 in encoding T2/A2.
U Encoded as op = 0 in both encodings, with U = 1 in encoding T2/A2.
I Encoding T1/A1 only, encoded as op = 0.
P Encoded as op = 1 in both encodings, with U= 0 in encoding T2/A2.
When <type> is P, <size> must be 8.
<size> The data size for the elements of the operands. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Qd>, <Dn>, <Dm> The destination vector and the operand vectors, for a long operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[Din[n+r],e,esize]; op1val = Int(op1, unsigned);
op2 = Elem[Din[m+r],e,esize]; op2val = Int(op2, unsigned);
if polynomial then
product = PolynomialMult(op1,op2);
else
product = (op1val*op2val)<2*esize-1:0>;
if long_destination then
Elem[Q[d>>1],e,2*esize] = product;
else
Elem[D[d+r],e,esize] = product<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-960 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D 0 sz Vn Vd 1 1 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D 0 sz Vn Vd 1 1 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
advsimd = TRUE; esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VMUL<c>.F64 <Dd>, <Dn>, <Dm>
VMUL<c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 0 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-961
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMUL{<c>}{<q>}.F32 {<Qd>,} <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1, sz = 0
VMUL{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0, sz = 0
VMUL{<c>}{<q>}.F64 {<Dd>,} <Dn>, <Dm> Encoding T2/A2, encoded as sz = 1
VMUL{<c>}{<q>}.F32 {<Sd>,} <Sn>, <Sm> Encoding T2/A2, encoded as sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMUL
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VMUL instruction is unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Sd>, <Sn>, <Sm> The destination vector and the operand vectors, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = FPMul(Elem[D[n+r],e,esize], Elem[D[m+r],e,esize], FALSE);
else // VFP instruction
if dp_operation then
D[d] = FPMul(D[n], D[m], TRUE);
else
S[d] = FPMul(S[n], S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-962 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about scalars see Advanced SIMD scalars on page A7-257.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 Q 1 1 1 1 1 D size Vn Vd 1 0 0 F N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 0 0 F N 1 M 0 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 1 0 1 0 N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 1 0 1 0 N 1 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-963
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMUL{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Dm[x]> Encoding T1/A1, encoded as Q = 1
VMUL{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm[x]> Encoding T1/A1, encoded as Q = 0
VMULL{<c>}{<q>}.<dt> <Qd>, <Dn>, <Dm[x]> Encoding T2/A2
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VMUL or VMULL
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced SIMD VMUL
or VMULL instruction is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the scalar, and the elements of the operand vector. It must be one of:
I16 Encoding T1/A1, encoded as size = 0b01, F = 0.
I32 Encoding T1/A1, encoded as size = 0b10, F = 0.
F32 Encoding T1/A1, encoded as size = 0b10, F = 1.
S16 Encoding T2/A2, encoded as size = 0b01, U = 0.
S32 Encoding T2/A2, encoded as size = 0b10, U = 0.
U16 Encoding T2/A2, encoded as size = 0b01, U = 1.
U32 Encoding T2/A2, encoded as size = 0b10, U = 1.
<Qd>, <Qn> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dn> The destination vector, and the operand vector, for a doubleword operation.
<Qd>, <Dn> The destination vector, and the operand vector, for a long operation.
<Dm[x]> The scalar. Dm is restricted to D0-D7 if <dt> is I16, S16, or U16, or D0-D15 otherwise.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
op2 = Elem[Din[m],index,esize]; op2val = Int(op2, unsigned);
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Elem[Din[n+r],e,esize]; op1val = Int(op1, unsigned);
if floating_point then
Elem[D[d+r],e,esize] = FPMul(op1, op2, FALSE);
else
if long_destination then
Elem[Q[d>>1],e,2*esize] = (op1val*op2val)<2*esize-1:0>;
else
Elem[D[d+r],e,esize] = (op1val*op2val)<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-964 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 i 1 1 1 1 1 D 0 0 0 imm3 Vd cmode 0 Q 1 1 imm4
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode 0 Q 1 1 imm4
if (cmode<0> == ‘1’ && cmode<3:2> != ‘11’) || cmode<3:1> == ‘111’ then SEE “Related encodings”;
if Q == ‘1’ && Vd<0> == ‘1’ then UNDEFINED;
imm64 = AdvSIMDExpandImm(‘1’, cmode, i:imm3:imm4);
d = UInt(D:Vd); regs = if Q == ‘0’ then 1 else 2;
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-965
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMVN{<c>}{<q>}.dt> <Qd>, #<imm> Encoding T1/A1, encoded as Q = 1
VMVN{<c>}{<q>}.dt> <Dd>, #<imm> Encoding T1/A1, encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VMVN instruction must be
unconditional. ARM strongly recommends that a Thumb VMVN instruction is unconditional, see
Conditional execution on page A8-286.
See One register and a modified immediate value on page A7-267 for the range of constants available, and the
encoding of <dt> and <imm>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = NOT(imm64);
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
One register and a modified immediate value on page A7-267 describes pseudo-instructions with a combination of
<dt> and <imm> that is not supported by hardware, but that generates the same destination register value as a different
combination that is supported by hardware.
A8-966 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 0 1 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 0 1 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-967
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VMVN{<c>}{<q>}{.<dt>} <Qd>, <Qm>
VMVN{<c>}{<q>}{.<dt>} <Dd>, <Dm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VMVN instruction must be
unconditional. ARM strongly recommends that a Thumb VMVN instruction is unconditional, see
Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = NOT(D[m+r]);
Exceptions
Undefined Instruction, Hyp Trap.
A8-968 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.356 VNEG
Vector Negate negates each element in a vector, and places the results in a second vector. The floating-point version
only inverts the sign bit.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 1 Vd 0 F 1 1 1 Q M 0 Vm
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VNEG<c>.F64 <Dd>, <Dm>
VNEG<c>.F32 <Sd>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 0 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 0 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-969
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VNEG{<c>}{<q>}.<dt> <Qd>, <Qm> Encoding T1/A1
VNEG{<c>}{<q>}.<dt> <Dd>, <Dm> Encoding T1/A1
VNEG{<c>}{<q>}.F32 <Sd>, <Sm> Floating-point only, encoding T2/A2, encoded as sz = 0
VNEG{<c>}{<q>}.F64 <Dd>, <Dm> Encoding T2/A2, encoded as sz = 1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VNEG instruction
must be unconditional. ARM strongly recommends that a Thumb Advanced SIMD VNEG instruction
is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00, F = 0.
S16 Encoded as size = 0b01, F = 0.
S32 Encoded as size = 0b10, F = 0.
F32 Encoded as size = 0b10, F = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
<Sd>, <Sm> The destination vector and the operand vector, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
Elem[D[d+r],e,esize] = FPNeg(Elem[D[m+r],e,esize]);
else
result = -SInt(Elem[D[m+r],e,esize]);
Elem[D[d+r],e,esize] = result<esize-1:0>;
else // VFP instruction
if dp_operation then
D[d] = FPNeg(D[m]);
else
S[d] = FPNeg(S[m]);
Exceptions
Undefined Instruction, Hyp Trap.
A8-970 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
VNMUL multiplies together two floating-point register values, and writes the negation of the result to the destination
register.
Note
ARM recommends that software does not use the VNMLA instruction in the Round towards Plus Infinity and Round
towards Minus Infinity rounding modes, because the rounding of the product and of the sum can change the result
of the instruction in opposite directions, defeating the purpose of these rounding modes.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
Encoding T1/A1 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VNMLA<c>.F64 <Dd>, <Dn>, <Dm>
VNMLA<c>.F32 <Sd>, <Sn>, <Sm>
VNMLS<c>.F64 <Dd>, <Dn>, <Dm>
VNMLS<c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 D 0 1 Vn Vd 1 0 1 sz N op M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VNMUL<c>.F64 <Dd>, <Dn>, <Dm>
VNMUL<c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 D 1 0 Vn Vd 1 0 1 sz N 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-971
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
VFP vectors These instructions can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
Assembler syntax
VN<op>{<c>}{<q>}.F64 <Dd>, <Dn>, <Dm> Encoding T1/A1, encoded as sz = 1
VN<op>{<c>}{<q>}.F32 <Sd>, <Sn>, <Sm> Encoding T1/A1, encoded as sz = 0
VNMUL{<c>}{<q>}.F64 {<Dd>,} <Dn>, <Dm> Encoding T2/A2, encoded as sz = 1
VNMUL{<c>}{<q>}.F32 {<Sd>,} <Sn>, <Sm> Encoding T2/A2, encoded as sz = 0
where:
<Dd>, <Dn>, <Dm> The destination register and the operand registers, for a double-precision operation.
<Sd>, <Sn>, <Sm> The destination register and the operand registers, for a single-precision operation.
Operation
enumeration VFPNegMul {VFPNegMul_VNMLA, VFPNegMul_VNMLS, VFPNegMul_VNMUL};
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if dp_operation then
product64 = FPMul(D[n], D[m], TRUE);
case type of
when VFPNegMul_VNMLA D[d] = FPAdd(FPNeg(D[d]), FPNeg(product64), TRUE);
when VFPNegMul_VNMLS D[d] = FPAdd(FPNeg(D[d]), product64, TRUE);
when VFPNegMul_VNMUL D[d] = FPNeg(product64);
else
product32 = FPMul(S[n], S[m], TRUE);
case type of
when VFPNegMul_VNMLA S[d] = FPAdd(FPNeg(S[d]), FPNeg(product32), TRUE);
when VFPNegMul_VNMLS S[d] = FPAdd(FPNeg(S[d]), product32, TRUE);
when VFPNegMul_VNMUL S[d] = FPNeg(product32);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-972 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 1 1 Vn Vd 0 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 1 1 Vn Vd 0 0 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-973
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VORN{<c>}{<q>}{.<dt>} {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VORN{<c>}{<q>}{.<dt>} {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VORN instruction must be
unconditional. ARM strongly recommends that a Thumb VORN instruction is unconditional,
see Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[n+r] OR NOT(D[m+r]);
Exceptions
Undefined Instruction, Hyp Trap.
A8-974 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 i 1 1 1 1 1 D 0 0 0 imm3 Vd cmode 0 Q 0 1 imm4
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 i 1 D 0 0 0 imm3 Vd cmode 0 Q 0 1 imm4
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-975
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VORR{<c>}{<q>}.<dt> {<Qd>,} <Qd>, #<imm> Encoded as Q = 1
VORR{<c>}{<q>}.<dt> {<Dd>,} <Dd>, #<imm>> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VORR instruction must be
unconditional. ARM strongly recommends that a Thumb VORR instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type used for <imm>. It can be either I16 or I32.
I8, I64, and F32 are also permitted, but the resulting syntax is a pseudo-instruction.
<imm> A constant of the type specified by <dt>. This constant is replicated enough times to fill the
destination register. For example, VORR.I32 D0, #10 ORs 0x0000000A0000000A into D0.
For details of the range of constants available, and the encoding of <dt> and <imm>, see One register and a modified
immediate value on page A7-267.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[d+r] OR imm64;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
VORN can be used, with a range of constants that are the bitwise inverse of the available constants for VORR. This is
assembled as the equivalent VORR instruction. Disassembly produces the VORR form.
One register and a modified immediate value on page A7-267 describes pseudo-instructions with a combination of
<dt> and <imm> that is not supported by hardware, but that generates the same destination register value as a different
combination that is supported by hardware.
A8-976 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 1 0 Vn Vd 0 0 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 1 0 Vn Vd 0 0 0 1 N Q M 1 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-977
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VORR{<c>}{<q>}{.<dt>} {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VORR{<c>}{<q>}{.<dt>} {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VORR instruction must be
unconditional. ARM strongly recommends that a Thumb VORR instruction is unconditional,
see Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
D[d+r] = D[n+r] OR D[m+r];
Exceptions
Undefined Instruction, Hyp Trap.
A8-978 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.362 VPADAL
Vector Pairwise Add and Accumulate Long adds adjacent pairs of elements of a vector, and accumulates the results
into the elements of the destination vector.
The vectors can be doubleword or quadword. The operand elements can be 8-bit, 16-bit, or 32-bit integers. The
result elements are twice the length of the operand elements.
Dm
+ +
Dd
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 1 0 op Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 0 op Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-979
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VPADAL{<c>}{<q>}.<dt> <Qd>, <Qm> Encoded as Q = 1
VPADAL{<c>}{<q>}.<dt> <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VPADAL instruction must be
unconditional. ARM strongly recommends that a Thumb VPADAL instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00, op = 0.
S16 Encoded as size = 0b01, op = 0.
S32 Encoded as size = 0b10, op = 0.
U8 Encoded as size = 0b00, op = 1.
U16 Encoded as size = 0b01, op = 1.
U32 Encoded as size = 0b10, op = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
h = elements DIV 2;
for r = 0 to regs-1
for e = 0 to h-1
op1 = Elem[D[m+r],2*e,esize]; op2 = Elem[D[m+r],2*e+1,esize];
result = Int(op1, unsigned) + Int(op2, unsigned);
Elem[D[d+r],e,2*esize] = Elem[D[d+r],e,2*esize] + result;
Exceptions
Undefined Instruction, Hyp Trap.
A8-980 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The operand and result elements must all be the same type, and can be 8-bit, 16-bit, or 32-bit integers. There is no
distinction between signed and unsigned integers.
Dm Dn
+ + + +
Dd
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D size Vn Vd 1 0 1 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 1 1 N Q M 1 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-981
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VPADD{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VPADD instruction must be
unconditional. ARM strongly recommends that a Thumb VPADD instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
I8 Encoding T1/A1, encoded as size = 0b00.
I16 Encoding T1/A1, encoded as size = 0b01.
I32 Encoding T1/A1, encoded as size = 0b10.
<Dd>, <Dn>, <Dm> The destination vector, the first operand vector, and the second operand vector.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
bits(64) dest;
h = elements DIV 2;
for e = 0 to h-1
Elem[dest,e,esize] = Elem[D[n],2*e,esize] + Elem[D[n],2*e+1,esize];
Elem[dest,e+h,esize] = Elem[D[m],2*e,esize] + Elem[D[m],2*e+1,esize];
D[d] = dest;
Exceptions
Undefined Instruction, Hyp Trap.
A8-982 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D 0 sz Vn Vd 1 1 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D 0 sz Vn Vd 1 1 0 1 N Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-983
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VPADD{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoded as Q = 0, sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VPADD instruction must be
unconditional. ARM strongly recommends that a Thumb VPADD instruction is unconditional,
see Conditional execution on page A8-286.
<Dd>, <Dn>, <Dm> The destination vector, the first operand vector, and the second operand vector.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
bits(64) dest;
h = elements DIV 2;
for e = 0 to h-1
Elem[dest,e,esize] = FPAdd(Elem[D[n],2*e,esize], Elem[D[n],2*e+1,esize], FALSE);
Elem[dest,e+h,esize] = FPAdd(Elem[D[m],2*e,esize], Elem[D[m],2*e+1,esize], FALSE);
D[d] = dest;
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-984 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.365 VPADDL
Vector Pairwise Add Long adds adjacent pairs of elements of two vectors, and places the results in the destination
vector.
The vectors can be doubleword or quadword. The operand elements can be 8-bit, 16-bit, or 32-bit integers. The
result elements are twice the length of the operand elements.
Dm
+ +
Dd
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 0 1 0 op Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 0 1 0 op Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-985
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VPADDL{<c>}{<q>}.<dt> <Qd>, <Qm> Encoded as Q = 1
VPADDL{<c>}{<q>}.<dt> <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VPADDL instruction must be
unconditional. ARM strongly recommends that a Thumb VPADDL instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00, op = 0.
S16 Encoded as size = 0b01, op = 0.
S32 Encoded as size = 0b10, op = 0.
U8 Encoded as size = 0b00, op = 1.
U16 Encoded as size = 0b01, op = 1.
U32 Encoded as size = 0b10, op = 1.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
h = elements DIV 2;
for r = 0 to regs-1
for e = 0 to h-1
op1 = Elem[D[m+r],2*e,esize]; op2 = Elem[D[m+r],2*e+1,esize];
result = Int(op1, unsigned) + Int(op2, unsigned);
Elem[D[d+r],e,2*esize] = result<2*esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-986 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Pairwise Minimum compares adjacent pairs of elements in two doubleword vectors, and copies the smaller
of each pair into the corresponding element in the destination doubleword vector.
Dm Dn
Dd
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 1 0 1 0 N Q M op Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 1 0 1 0 N Q M op Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-987
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VP<op>{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VPMAX or VPMIN instruction
must be unconditional. ARM strongly recommends that a Thumb VPMAX or VPMIN instruction
is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoding T1/A1, encoded as size = 0b00, U = 0.
S16 Encoding T1/A1, encoded as size = 0b01, U = 0.
S32 Encoding T1/A1, encoded as size = 0b10, U = 0.
U8 Encoding T1/A1, encoded as size = 0b00, U = 1.
U16 Encoding T1/A1, encoded as size = 0b01, U = 1.
U32 Encoding T1/A1, encoded as size = 0b10, U = 1.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
bits(64) dest;
h = elements DIV 2;
for e = 0 to h-1
op1 = Int(Elem[D[n],2*e,esize], unsigned);
op2 = Int(Elem[D[n],2*e+1,esize], unsigned);
result = if maximum then Max(op1,op2) else Min(op1,op2);
Elem[dest,e,esize] = result<esize-1:0>;
op1 = Int(Elem[D[m],2*e,esize], unsigned);
op2 = Int(Elem[D[m],2*e+1,esize], unsigned);
result = if maximum then Max(op1,op2) else Min(op1,op2);
Elem[dest,e+h,esize] = result<esize-1:0>;
D[d] = dest;
Exceptions
Undefined Instruction, Hyp Trap.
A8-988 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Pairwise Minimum compares adjacent pairs of elements in two doubleword vectors, and copies the smaller
of each pair into the corresponding element in the destination doubleword vector.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D op sz Vn Vd 1 1 1 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D op sz Vn Vd 1 1 1 1 N Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-989
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VP<op>{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoded as Q = 0, sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VPMAX or VPMIN instruction
must be unconditional. ARM strongly recommends that a Thumb VPMAX or VPMIN instruction
is unconditional, see Conditional execution on page A8-286.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
bits(64) dest;
h = elements DIV 2;
for e = 0 to h-1
op1 = Elem[D[n],2*e,esize]; op2 = Elem[D[n],2*e+1,esize];
Elem[dest,e,esize] = if maximum then FPMax(op1,op2,FALSE) else FPMin(op1,op2,FALSE);
op1 = Elem[D[m],2*e,esize]; op2 = Elem[D[m],2*e+1,esize];
Elem[dest,e+h,esize] = if maximum then FPMax(op1,op2,FALSE) else FPMin(op1,op2,FALSE);
D[d] = dest;
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-990 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.368 VPOP
Vector Pop loads multiple consecutive extension registers from the stack.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 1 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 0 1 D 1 1 1 1 0 1 Vd 1 0 1 0 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
FLDMX Encoding T1/A1 behaves as described by the pseudocode if imm8 is odd. However,
there is no UAL syntax for such encodings and ARM deprecates their use. For more
information, see FLDMX, FSTMX on page A8-389.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-991
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VPOP{<c>}{<q>}{.<size>} <list>
where:
<size> An optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers
in <list>.
<list> The extension registers to be loaded, as a list of consecutively numbered doubleword (encoding
T1/A1) or singleword (encoding T2/A2) registers, separated by commas and surrounded by
brackets. It is encoded in the instruction by setting D and Vd to specify the first register in the list,
and imm8 to twice the number of registers in the list (encoding T1/A1) or the number of registers
in the list (encoding T2/A2). <list> must contain at least one register, and not more than sixteen.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(13);
address = SP;
SP = SP + imm32;
if single_regs then
for r = 0 to regs-1
S[d+r] = MemA[address,4]; address = address+4;
else
for r = 0 to regs-1
word1 = MemA[address,4]; word2 = MemA[address+4,4]; address = address+8;
// Combine the word-aligned words in the correct order for current endianness.
D[d+r] = if BigEndian() then word1:word2 else word2:word1;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-992 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.369 VPUSH
Vector Push stores multiple consecutive extension registers to the stack.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 1 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 1 0 D 1 0 1 1 0 1 Vd 1 0 1 0 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
FSTMX Encoding T1/A1 behaves as described by the pseudocode if imm8 is odd. However,
there is no UAL syntax for such encodings and ARM deprecates their use. For more
information, see FLDMX, FSTMX on page A8-389.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-993
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VPUSH{<c>}{<q>}{.<size>} <list>
where:
<size> An optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers
in <list>.
<list> The extension registers to be stored, as a list of consecutively numbered doubleword (encoding
T1/A1) or singleword (encoding T2/A2) registers, separated by commas and surrounded by
brackets. It is encoded in the instruction by setting D and Vd to specify the first register in the list,
and imm8 to twice the number of registers in the list (encoding T1/A1), or the number of registers
in the list (encoding T2/A2). <list> must contain at least one register, and not more than sixteen.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(13);
address = SP - imm32;
SP = SP - imm32;
if single_regs then
for r = 0 to regs-1
MemA[address,4] = S[d+r]; address = address+4;
else
for r = 0 to regs-1
// Store as two word-aligned words in the correct order for current endianness.
MemA[address,4] = if BigEndian() then D[d+r]<63:32> else D[d+r]<31:0>;
MemA[address+4,4] = if BigEndian() then D[d+r]<31:0> else D[d+r]<63:32>;
address = address+8;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-994 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.370 VQABS
Vector Saturating Absolute takes the absolute value of each element in a vector, and places the results in the
destination vector.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-995
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VQABS{<c>}{<q>}.<dt> <Qd>, <Qm> Encoded as Q = 1
VQABS{<c>}{<q>}.<dt> <Dd>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQABS instruction must be
unconditional. ARM strongly recommends that a Thumb VQABS instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00.
S16 Encoded as size = 0b01.
S32 Encoded as size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
result = Abs(SInt(Elem[D[m+r],e,esize]));
(Elem[D[d+r],e,esize], sat) = SignedSatQ(result, esize);
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-996 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.371 VQADD
Vector Saturating Add adds the values of corresponding elements of two vectors, and places the results in the
destination vector.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 0 0 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 0 0 N Q M 1 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-997
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQADD instruction must be
unconditional. ARM strongly recommends that a Thumb VQADD instruction is unconditional,
see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
64 Encoded as size = 0b11.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
sum = Int(Elem[D[n+r],e,esize], unsigned) + Int(Elem[D[m+r],e,esize], unsigned);
(Elem[D[d+r],e,esize], sat) = SatQ(sum, esize, unsigned);
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-998 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Saturating Doubling Multiply Subtract Long multiplies corresponding elements in two doubleword vectors,
subtracts double the products from corresponding elements of a quadword vector, and places the results in the same
quadword vector.
In both instructions, the second operand can be a scalar instead of a vector. For more information about scalars see
Advanced SIMD scalars on page A7-257.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D size Vn Vd 1 0 op 1 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D size Vn Vd 1 0 op 1 N 0 M 0 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D size Vn Vd 0 op 1 1 N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D size Vn Vd 0 op 1 1 N 1 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-999
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQDMLAL or VQDMLSL instruction must
be unconditional. ARM strongly recommends that a Thumb VQDMLAL or VQDMLSL instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
S16 Encoded as size = 0b01.
S32 Encoded as size = 0b10.
<Qd>, <Dn> The destination vector and the first operand vector.
<Dm[x]> The scalar for a scalar operation. If <dt> is S16, Dm is restricted to D0-D7. If <dt> is S32, Dm is restricted
to D0-D15.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
if scalar_form then op2 = SInt(Elem[Din[m],index,esize]);
for e = 0 to elements-1
if !scalar_form then op2 = SInt(Elem[Din[m],e,esize]);
op1 = SInt(Elem[Din[n],e,esize]);
// The following only saturates if both op1 and op2 equal -(2^(esize-1))
(product, sat1) = SignedSatQ(2*op1*op2, 2*esize);
if add then
result = SInt(Elem[Qin[d>>1],e,2*esize]) + SInt(product);
else
result = SInt(Elem[Qin[d>>1],e,2*esize]) - SInt(product);
(Elem[Q[d>>1],e,2*esize], sat2) = SignedSatQ(result, 2*esize);
if sat1 || sat2 then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1000 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.373 VQDMULH
Vector Saturating Doubling Multiply Returning High Half multiplies corresponding elements in two vectors,
doubles the results, and places the most significant half of the final results in the destination vector. The results are
truncated (for rounded results see VQRDMULH on page A8-1009).
The second operand can be a scalar instead of a vector. For more information about scalars see Advanced SIMD
scalars on page A7-257.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘00’ || size == ‘11’ then UNDEFINED;
scalar_form = FALSE; esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 Q 1 1 1 1 1 D size Vn Vd 1 1 0 0 N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 1 0 0 N 1 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1001
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQDMULH instruction must
be unconditional. ARM strongly recommends that a Thumb VQDMULH instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
S16 Encoded as size = 0b01.
S32 Encoded as size = 0b10.
<Qd>, <Qn> The destination vector and the first operand vector, for a quadword operation.
<Dd>, <Dn> The destination vector and the first operand vector, for a doubleword operation.
<Qm> The second operand vector, for a quadword all vector operation.
<Dm> The second operand vector, for a doubleword all vector operation.
<Dm[x]> The scalar for either a quadword or a doubleword scalar operation. If <dt> is S16, Dm is
restricted to D0-D7. If <dt> is S32, Dm is restricted to D0-D15.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
if scalar_form then op2 = SInt(Elem[D[m],index,esize]);
for r = 0 to regs-1
for e = 0 to elements-1
if !scalar_form then op2 = SInt(Elem[D[m+r],e,esize]);
op1 = SInt(Elem[D[n+r],e,esize]);
// The following only saturates if both op1 and op2 equal -(2^(esize-1))
(result, sat) = SignedSatQ((2*op1*op2) >> esize, esize);
Elem[D[d+r],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1002 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.374 VQDMULL
Vector Saturating Doubling Multiply Long multiplies corresponding elements in two doubleword vectors, doubles
the products, and places the results in a quadword vector.
The second operand can be a scalar instead of a vector. For more information about scalars see Advanced SIMD
scalars on page A7-257.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D size Vn Vd 1 1 0 1 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D size Vn Vd 1 1 0 1 N 0 M 0 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D size Vn Vd 1 0 1 1 N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D size Vn Vd 1 0 1 1 N 1 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1003
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQDMULL instruction must be
unconditional. ARM strongly recommends that a Thumb VQDMULL instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
S16 Encoded as size = 0b01.
S32 Encoded as size = 0b10.
<Qd>, <Dn> The destination vector and the first operand vector.
<Dm[x]> The scalar for a scalar operation. If <dt> is S16, Dm is restricted to D0-D7. If <dt> is S32, Dm is restricted
to D0-D15.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
if scalar_form then op2 = SInt(Elem[Din[m],index,esize]);
for e = 0 to elements-1
if !scalar_form then op2 = SInt(Elem[Din[m],e,esize]);
op1 = SInt(Elem[Din[n],e,esize]);
// The following only saturates if both op1 and op2 equal -(2^(esize-1))
(product, sat) = SignedSatQ(2*op1*op2, 2*esize);
Elem[Q[d>>1],e,2*esize] = product;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1004 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The operand is a quadword vector. The elements can be any one of:
• 16-bit, 32-bit, or 64-bit signed integers
• 16-bit, 32-bit, or 64-bit unsigned integers.
The result is a doubleword vector. The elements are half the length of the operand vector elements. If the operand
is unsigned, the results are unsigned. If the operand is signed, the results can be signed or unsigned.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 op M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 0 op M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1005
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
U If present, specifies that the operation produces unsigned results, even though the operands are
signed. Encoded as op = 0b01.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQMOVN or VQMOVUN instruction must
be unconditional. ARM strongly recommends that a Thumb VQMOVN or VQMOVUN instruction is
unconditional, see Conditional execution on page A8-286.
<type> The data type for the elements of the operand. It must be one of:
S Encoded as:
• op = 0b10 for VQMOVN.
• op = 0b01 for VQMOVUN.
U Encoded as op = 0b11. Not available for VQMOVUN.
<size> The data size for the elements of the operand. It must be one of:
16 Encoded as size = 0b00.
32 Encoded as size = 0b01.
64 Encoded as size = 0b10.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
operand = Int(Elem[Qin[m>>1],e,2*esize], src_unsigned);
(Elem[D[d],e,esize], sat) = SatQ(operand, esize, dest_unsigned);
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1006 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.376 VQNEG
Vector Saturating Negate negates each element in a vector, and places the results in the destination vector.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 1 1 1 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1007
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQNEG instruction must be
unconditional. ARM strongly recommends that a Thumb VQNEG instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00.
S16 Encoded as size = 0b01.
S32 Encoded as size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
result = -SInt(Elem[D[m+r],e,esize]);
(Elem[D[d+r],e,esize], sat) = SignedSatQ(result, esize);
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1008 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.377 VQRDMULH
Vector Saturating Rounding Doubling Multiply Returning High Half multiplies corresponding elements in two
vectors, doubles the results, and places the most significant half of the final results in the destination vector. The
results are rounded (for truncated results see VQDMULH on page A8-1001).
The second operand can be a scalar instead of a vector. For more information about scalars see Advanced SIMD
scalars on page A7-257.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 1 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘00’ || size == ‘11’ then UNDEFINED;
scalar_form = FALSE; esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 Q 1 1 1 1 1 D size Vn Vd 1 1 0 1 N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 Q 1 D size Vn Vd 1 1 0 1 N 1 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1009
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQRDMULH instruction must
be unconditional. ARM strongly recommends that a Thumb VQRDMULH instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
S16 Encoded as size = 0b01.
S32 Encoded as size = 0b10.
<Qd>, <Qn> The destination vector and the first operand vector, for a quadword operation.
<Dd>, <Dn> The destination vector and the first operand vector, for a doubleword operation.
<Qm> The second operand vector, for a quadword all vector operation.
<Dm> The second operand vector, for a doubleword all vector operation.
<Dm[x]> The scalar for either a quadword or a doubleword scalar operation. If <dt> is S16, Dm is
restricted to D0-D7. If <dt> is S32, Dm is restricted to D0-D15.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (esize-1);
if scalar_form then op2 = SInt(Elem[D[m],index,esize]);
for r = 0 to regs-1
for e = 0 to elements-1
op1 = SInt(Elem[D[n+r],e,esize]);
if !scalar_form then op2 = SInt(Elem[D[m+r],e,esize]);
(result, sat) = SignedSatQ((2*op1*op2 + round_const) >> esize, esize);
Elem[D[d+r],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1010 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.378 VQRSHL
Vector Saturating Rounding Shift Left takes each element in a vector, shifts them by a value from the least
significant byte of the corresponding element of a second vector, and places the results in the destination vector. If
the shift value is positive, the operation is a left shift. Otherwise, it is a right shift.
The first operand and result elements are the same data type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 0 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vm<0> == ‘1’ || Vn<0> == ‘1’) then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); m = UInt(M:Vm); n = UInt(N:Vn); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1011
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQRSHL instruction must be
unconditional. ARM strongly recommends that a Thumb VQRSHL instruction is
unconditional, see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
Together with the <size> field, this indicates the data type and size of the first operand and
the result.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
64 Encoded as size = 0b11.
<Qd>, <Qm>, <Qn> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dm>, <Dn> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
shift = SInt(Elem[D[n+r],e,esize]<7:0>);
round_const = 1 << (-1-shift); // 0 for left shift, 2^(n-1) for right shift
operand = Int(Elem[D[m+r],e,esize], unsigned);
(result, sat) = SatQ((operand + round_const) << shift, esize, unsigned);
Elem[D[d+r],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1012 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The operand elements must all be the same size, and can be any one of:
• 16-bit, 32-bit, or 64-bit signed integers
• 16-bit, 32-bit, or 64-bit unsigned integers.
The result elements are half the width of the operand elements. If the operand elements are signed, the results can
be either signed or unsigned. If the operand elements are unsigned, the result elements must also be unsigned.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 1 0 0 op 0 1 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 0 op 0 1 M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1013
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
U If present, specifies that the results are unsigned, although the operands are signed.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQRSHRN or VQRSHRUN instruction
must be unconditional. ARM strongly recommends that a Thumb VQRSHRN or VQRSHRUN instruction is
unconditional, see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed. Encoded as:
• U = 0, op = 1, for VQRSHRN.
• U = 1, op = 0, for VQRSHRUN.
U Unsigned:
• Encoded as U = 1, op = 1, for VQRSHRN.
• Not available for VQRSHRUN.
<size> The data size for the elements of the vectors. It must be one of:
16 Encoded as imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
32 Encoded as imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
64 Encoded as imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
<imm> The immediate value, in the range 1 to <size>/2. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (shift_amount - 1);
for e = 0 to elements-1
operand = Int(Elem[Qin[m>>1],e,2*esize], src_unsigned);
(result, sat) = SatQ((operand + round_const) >> shift_amount, esize, dest_unsigned);
Elem[D[d],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
A8-1014 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The results are truncated. For rounded results, see VQRSHL on page A8-1011.
The first operand and result elements are the same data type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 0 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 0 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vm<0> == ‘1’ || Vn<0> == ‘1’) then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); m = UInt(M:Vm); n = UInt(N:Vn); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1015
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQSHL instruction must be
unconditional. ARM strongly recommends that a Thumb VQSHL instruction is unconditional,
see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
Together with the <size> field, this indicates the data type and size of the first operand and
the result.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
64 Encoded as size = 0b11.
<Qd>, <Qm>, <Qn> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dm>, <Dn> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
shift = SInt(Elem[D[n+r],e,esize]<7:0>);
operand = Int(Elem[D[m+r],e,esize], unsigned);
(result,sat) = SatQ(operand << shift, esize, unsigned);
Elem[D[d+r],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1016 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The operand elements must all be the same size, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
The result elements are the same size as the operand elements. If the operand elements are signed, the results can
be either signed or unsigned. If the operand elements are unsigned, the result elements must also be unsigned.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 0 1 1 op L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 0 1 1 op L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1017
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
U If present, specifies that the results are unsigned, although the operands are signed.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQSHL or VQSHLU instruction must be
unconditional. ARM strongly recommends that a Thumb VQSHL or VQSHLU instruction is
unconditional, see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed. Encoded as:
• U = 0, op = 1, for VQSHL.
• U = 1, op = 0, for VQSHLU.
U Unsigned:
• Encoded as U = 1, op = 1, for VQSHL.
• Not available for VQSHLU.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. <imm> is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. <imm> is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. <imm> is encoded in imm6<4:0>.
64 Encoded as L = 1. <imm> is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 0 to <size>-1. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
operand = Int(Elem[D[m+r],e,esize], src_unsigned);
(result, sat) = SatQ(operand << shift_amount, esize, dest_unsigned);
Elem[D[d+r],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1018 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The operand elements must all be the same size, and can be any one of:
• 16-bit, 32-bit, or 64-bit signed integers
• 16-bit, 32-bit, or 64-bit unsigned integers.
The result elements are half the width of the operand elements. If the operand elements are signed, the results can
be either signed or unsigned. If the operand elements are unsigned, the result elements must also be unsigned.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 1 0 0 op 0 0 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 0 op 0 0 M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1019
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
U If present, specifies that the results are unsigned, although the operands are signed.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQSHRN or VQSHRUN instruction must
be unconditional. ARM strongly recommends that a Thumb VQSHRN or VQSHRUN instruction is
unconditional, see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed. Encoded as:
• U = 0, op = 1, for VQSHRN.
• U = 1, op = 0, for VQSHRUN.
U Unsigned:
• Encoded as U = 1, op = 1, for VQSHRN.
• Not available for VQSHRUN.
<size> The data size for the elements of the vectors. It must be one of:
16 Encoded as imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
32 Encoded as imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
64 Encoded as imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
<imm> The immediate value, in the range 1 to <size>/2. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
operand = Int(Elem[Qin[m>>1],e,2*esize], src_unsigned);
(result, sat) = SatQ(operand >> shift_amount, esize, dest_unsigned);
Elem[D[d],e,esize] = result;
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
A8-1020 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.383 VQSUB
Vector Saturating Subtract subtracts the elements of the second operand vector from the corresponding elements of
the first operand vector, and places the results in the destination vector. Signed and unsigned operations are distinct.
The operand and result elements must all be the same type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
If any of the results overflow, they are saturated. The cumulative saturation bit, FPSCR.QC, is set if saturation
occurs. For details see Pseudocode details of saturation on page A2-44.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 0 1 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 1 0 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1021
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VQSUB instruction must be
unconditional. ARM strongly recommends that a Thumb VQSUB instruction is unconditional,
see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
64 Encoded as size = 0b11.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
diff = Int(Elem[D[n+r],e,esize], unsigned) - Int(Elem[D[m+r],e,esize], unsigned);
(Elem[D[d+r],e,esize], sat) = SatQ(diff, esize, unsigned);
if sat then FPSCR.QC = ‘1’;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1022 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.384 VRADDHN
Vector Rounding Add and Narrow, returning High Half adds corresponding elements in two quadword vectors, and
places the most significant half of each result in a doubleword vector. The results are rounded. (For truncated results,
see VADDHN on page A8-833.)
The operand elements can be 16-bit, 32-bit, or 64-bit integers. There is no distinction between signed and unsigned
integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D size Vn Vd 0 1 0 0 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1023
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VRADDHN{<c>}{<q>}.<dt> <Dd>, <Qn>, <Qm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRADDHN instruction must
be unconditional. ARM strongly recommends that a Thumb VRADDHN instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
I16 Encoded as size = 0b00.
I32 Encoded as size = 0b01.
I64 Encoded as size = 0b10.
<Dd>, <Qn>, <Qm> The destination vector and the operand vectors.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (esize-1);
for e = 0 to elements-1
result = Elem[Qin[n>>1],e,2*esize] + Elem[Qin[m>>1],e,2*esize] + round_const;
Elem[D[d],e,esize] = result<2*esize-1:esize>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1024 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.385 VRECPE
Vector Reciprocal Estimate finds an approximate reciprocal of each element in the operand vector, and places the
results in the destination vector.
The operand and result elements are the same type, and can be 32-bit floating-point numbers, or 32-bit unsigned
integers.
For details of the operation performed by this instruction see Floating-point reciprocal estimate and step on
page A2-84.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1025
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRECPE instruction must be
unconditional. ARM strongly recommends that a Thumb VRECPE instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data types for the elements of the vectors. It must be one of:
U32 Encoded as F = 0, size = 0b10.
F32 Encoded as F = 1, size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
Elem[D[d+r],e,esize] = FPRecipEstimate(Elem[D[m+r],e,esize]);
else
Elem[D[d+r],e,esize] = UnsignedRecipEstimate(Elem[D[m+r],e,esize]);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Newton-Raphson iteration
For details of the operation performed and how it can be used in a Newton-Raphson iteration to calculate the
reciprocal of a number, see Floating-point reciprocal estimate and step on page A2-84.
A8-1026 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.386 VRECPS
Vector Reciprocal Step multiplies the elements of one vector by the corresponding elements of another vector,
subtracts each of the products from 2.0, and places the results into the elements of the destination vector.
For details of the operation performed by this instruction see Floating-point reciprocal estimate and step on
page A2-84.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 0 sz Vn Vd 1 1 1 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 0 sz Vn Vd 1 1 1 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1027
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRECPS instruction must be
unconditional. ARM strongly recommends that a Thumb VRECPS instruction is
unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = FPRecipStep(Elem[D[n+r],e,esize], Elem[D[m+r],e,esize]);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Newton-Raphson iteration
For details of the operation performed and how it can be used in a Newton-Raphson iteration to calculate the
reciprocal of a number, see Floating-point reciprocal estimate and step on page A2-84.
A8-1028 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
VREV64 (Vector Reverse in doublewords) reverses the order of 8-bit, 16-bit, or 32-bit elements in each doubleword
of the vector, and places the result in the corresponding destination vector.
Dd Qm
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 0 0 Vd 0 0 0 op Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 0 0 Vd 0 0 0 op Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1029
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<n> The size of the regions in which the vector elements are reversed. It must be one of:
16 Encoded as op = 0b10.
32 Encoded as op = 0b01.
64 Encoded as op = 0b00.
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VREV instruction must be
unconditional. ARM strongly recommends that a Thumb VREV instruction is unconditional, see
Conditional execution on page A8-286.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
bits(64) dest;
for r = 0 to regs-1
for e = 0 to elements-1
// Calculate destination element index by bitwise EOR on source element index:
e_bits = e<esize-1:0>; d_bits = e_bits EOR reverse_mask; d = UInt(d_bits);
Elem[dest,d,esize] = Elem[D[m+r],e,esize];
D[d+r] = dest;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1030 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.388 VRHADD
Vector Rounding Halving Add adds corresponding elements in two vectors of integers, shifts each result right one
bit, and places the final results in the destination vector.
The operand and result elements are all the same type, and can be any one of:
• 8-bit, 16-bit, or 32-bit signed integers
• 8-bit, 16-bit, or 32-bit unsigned integers.
The results of the halving operations are rounded. For truncated results see VHADD, VHSUB on page A8-897.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 0 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 0 0 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1031
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRHADD instruction must be
unconditional. ARM strongly recommends that a Thumb VRHADD instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
S8 Encoded as size = 0b00, U = 0.
S16 Encoded as size = 0b01, U = 0.
S32 Encoded as size = 0b10, U = 0.
U8 Encoded as size = 0b00, U = 1.
U16 Encoded as size = 0b01, U = 1.
U32 Encoded as size = 0b10, U = 1.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
op1 = Int(Elem[D[n+r],e,esize], unsigned);
op2 = Int(Elem[D[m+r],e,esize], unsigned);
result = op1 + op2 + 1;
Elem[D[d+r],e,esize] = result<esize:1>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1032 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.389 VRSHL
Vector Rounding Shift Left takes each element in a vector, shifts them by a value from the least significant byte of
the corresponding element of a second vector, and places the results in the destination vector. If the shift value is
positive, the operation is a left shift. If the shift value is negative, it is a rounding right shift. (For a truncating shift,
see VSHL (register) on page A8-1049).
The first operand and result elements are the same data type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vm<0> == ‘1’ || Vn<0> == ‘1’) then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); m = UInt(M:Vm); n = UInt(N:Vn); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1033
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSHL instruction must be
unconditional. ARM strongly recommends that a Thumb VRSHL instruction is unconditional,
see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
Together with the <size> field, this indicates the data type and size of the first operand and
the result.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
64 Encoded as size = 0b11.
<Qd>, <Qm>, <Qn> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dm>, <Dn> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
shift = SInt(Elem[D[n+r],e,esize]<7:0>);
round_const = 1 << (-shift-1); // 0 for left shift, 2^(n-1) for right shift
result = (Int(Elem[D[m+r],e,esize], unsigned) + round_const) << shift;
Elem[D[d+r],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1034 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.390 VRSHR
Vector Rounding Shift Right takes each element in a vector, right shifts them by an immediate value, and places the
rounded results in the destination vector. For truncated results, see VSHR on page A8-1053.
The operand and result elements must be the same size, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers.
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 0 0 1 0 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 1 0 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1035
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSHR instruction must be
unconditional. ARM strongly recommends that a Thumb VRSHR instruction is unconditional, see
Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0
U Unsigned, encoded as U = 1.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
64 Encoded as L = 1. (64 – <imm>) is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 1 to <size>. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (shift_amount - 1);
for r = 0 to regs-1
for e = 0 to elements-1
result = (Int(Elem[D[m+r],e,esize], unsigned) + round_const) >> shift_amount;
Elem[D[d+r],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
A8-1036 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.391 VRSHRN
Vector Rounding Shift Right and Narrow takes each element in a vector, right shifts them by an immediate value,
and places the rounded results in the destination vector. For truncated results, see VSHRN on page A8-1055.
The operand elements can be 16-bit, 32-bit, or 64-bit integers. There is no distinction between signed and unsigned
integers. The destination elements are half the size of the source elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D imm6 Vd 1 0 0 0 0 1 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D imm6 Vd 1 0 0 0 0 1 M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1037
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSHRN instruction must be
unconditional. ARM strongly recommends that a Thumb VRSHRN instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
16 Encoded as imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
32 Encoded as imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
64 Encoded as imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
<imm> The immediate value, in the range 1 to <size>/2. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (shift_amount-1);
for e = 0 to elements-1
result = LSR(Elem[Qin[m>>1],e,2*esize] + round_const, shift_amount);
Elem[D[d],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
A8-1038 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.392 VRSQRTE
Vector Reciprocal Square Root Estimate finds an approximate reciprocal square root of each element in a vector,
and places the results in a second vector.
The operand and result elements are the same type, and can be 32-bit floating-point numbers, or 32-bit unsigned
integers.
For details of the operation performed by this instruction see Floating-point reciprocal square root estimate and
step on page A2-86.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 1 Vd 0 1 0 F 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1039
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSQRTE instruction must be
unconditional. ARM strongly recommends that a Thumb VRSQRTE instruction is unconditional, see
Conditional execution on page A8-286.
<dt> The data types for the elements of the vectors. It must be one of:
U32 Encoded as F = 0, size = 0b10.
F32 Encoded as F = 1, size = 0b10.
<Qd>, <Qm> The destination vector and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if floating_point then
Elem[D[d+r],e,esize] = FPRSqrtEstimate(Elem[D[m+r],e,esize]);
else
Elem[D[d+r],e,esize] = UnsignedRSqrtEstimate(Elem[D[m+r],e,esize]);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Newton-Raphson iteration
For details of the operation performed and how it can be used in a Newton-Raphson iteration to calculate the
reciprocal of the square root of a number, see Floating-point reciprocal square root estimate and step on
page A2-86.
A8-1040 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.393 VRSQRTS
Vector Reciprocal Square Root Step multiplies the elements of one vector by the corresponding elements of another
vector, subtracts each of the products from 3.0, divides these results by 2.0, and places the results into the elements
of the destination vector.
For details of the operation performed by this instruction see Floating-point reciprocal square root estimate and
step on page A2-86.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 1 sz Vn Vd 1 1 1 1 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 1 sz Vn Vd 1 1 1 1 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1041
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSQRTS instruction must
be unconditional. ARM strongly recommends that a Thumb VRSQRTS instruction is
unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = FPRSqrtStep(Elem[D[n+r],e,esize], Elem[D[m+r],e,esize]);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
Newton-Raphson iteration
For details of the operation performed and how it can be used in a Newton-Raphson iteration to calculate the
reciprocal of the square root of a number, see Floating-point reciprocal square root estimate and step on
page A2-86.
A8-1042 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.394 VRSRA
Vector Rounding Shift Right and Accumulate takes each element in a vector, right shifts them by an immediate
value, and accumulates the rounded results into the destination vector. (For truncated results, see VSRA on
page A8-1061.)
The operand and result elements must all be the same type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers.
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 0 0 1 1 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 1 1 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1043
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSRA instruction must be
unconditional. ARM strongly recommends that a Thumb VRSRA instruction is unconditional, see
Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
64 Encoded as L = 1. (64 – <imm>) is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 1 to <size>. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (shift_amount - 1);
for r = 0 to regs-1
for e = 0 to elements-1
result = (Int(Elem[D[m+r],e,esize], unsigned) + round_const) >> shift_amount;
Elem[D[d+r],e,esize] = Elem[D[d+r],e,esize] + result;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1044 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.395 VRSUBHN
Vector Rounding Subtract and Narrow, returning High Half subtracts the elements of one quadword vector from the
corresponding elements of another quadword vector takes the most significant half of each result, and places the
final results in a doubleword vector. The results are rounded. (For truncated results, see VSUBHN on
page A8-1089.)
The operand elements can be 16-bit, 32-bit, or 64-bit integers. There is no distinction between signed and unsigned
integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1045
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VRSUBHN{<c>}{<q>}.<dt> <Dd>, <Qn>, <Qm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VRSUBHN instruction must
be unconditional. ARM strongly recommends that a Thumb VRSUBHN instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
I16 Encoded as size = 0b00.
I32 Encoded as size = 0b01.
I64 Encoded as size = 0b10.
<Dd>, <Qn>, <Qm> The destination vector and the operand vectors.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
round_const = 1 << (esize-1);
for e = 0 to elements-1
result = Elem[Qin[n>>1],e,2*esize] - Elem[Qin[m>>1],e,2*esize] + round_const;
Elem[D[d],e,esize] = result<2*esize-1:esize>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1046 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
The elements must all be the same size, and can be 8-bit, 16-bit, 32-bit, or 64-bit integers. There is no distinction
between signed and unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D imm6 Vd 0 1 0 1 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D imm6 Vd 0 1 0 1 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1047
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSHL instruction must be
unconditional. ARM strongly recommends that a Thumb VSHL instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. <imm> is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. <imm> is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. <imm> is encoded in imm6<4:0>.
64 Encoded as L = 1. <imm> is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 0 to <size>-1. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = LSL(Elem[D[m+r],e,esize], shift_amount);
Exceptions
Undefined Instruction, Hyp Trap.
A8-1048 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Note
For a rounding shift, see VRSHL on page A8-1033.
The first operand and result elements are the same data type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 0 D size Vn Vd 0 1 0 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 0 D size Vn Vd 0 1 0 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vm<0> == ‘1’ || Vn<0> == ‘1’) then UNDEFINED;
unsigned = (U == ‘1’);
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); m = UInt(M:Vm); n = UInt(N:Vn); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1049
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSHL instruction must be
unconditional. ARM strongly recommends that a Thumb VSHL instruction is unconditional,
see Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
Together with the <size> field, this indicates the data type and size of the first operand and
the result.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
64 Encoded as size = 0b11.
<Qd>, <Qm>, <Qn> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dm>, <Dn> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
shift = SInt(Elem[D[n+r],e,esize]<7:0>);
result = Int(Elem[D[m+r],e,esize], unsigned) << shift;
Elem[D[d+r],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1050 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.398 VSHLL
Vector Shift Left Long takes each element in a doubleword vector, left shifts them by an immediate value, and places
the results in a quadword vector.
The result elements are twice the length of the operand elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 1 0 1 0 0 0 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 1 0 1 0 0 0 M 1 Vm
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 1 1 0 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 1 1 0 0 M 0 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1051
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSHLL instruction must be
unconditional. ARM strongly recommends that a Thumb VSHLL instruction is unconditional, see
Conditional execution on page A8-286.
<type> The data type for the elements of the operand. It must be one of:
S Signed. In encoding T1/A1, encoded as U = 0.
U Unsigned. In encoding T1/A1, encoded as U = 1.
I Untyped integer, Available only in encoding T2/A2.
<size> The data size for the elements of the operand. Table A8-8 shows the permitted values and their
encodings:
<imm> The immediate value. <imm> must lie in the range 1 to <size>, and:
• if <size> == <imm>, the encoding is T2/A2
• otherwise, the encoding is T1/A1, and:
— if <size> == 8, <imm> is encoded in imm6<2:0>
— if <size> == 16, <imm> is encoded in imm6<3:0>
— if <size> == 32, <imm> is encoded in imm6<4:0>.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
result = Int(Elem[Din[m],e,esize], unsigned) << shift_amount;
Elem[Q[d>>1],e,2*esize] = result<2*esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1052 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.399 VSHR
Vector Shift Right takes each element in a vector, right shifts them by an immediate value, and places the truncated
results in the destination vector. For rounded results, see VRSHR on page A8-1035.
The operand and result elements must be the same size, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers.
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 0 0 0 0 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 0 0 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1053
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSHR instruction must be
unconditional. ARM strongly recommends that a Thumb VSHR instruction is unconditional, see
Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
64 Encoded as L = 1. (64 – <imm>) is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 1 to <size>. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
result = Int(Elem[D[m+r],e,esize], unsigned) >> shift_amount;
Elem[D[d+r],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
A8-1054 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.400 VSHRN
Vector Shift Right Narrow takes each element in a vector, right shifts them by an immediate value, and places the
truncated results in the destination vector. For rounded results, see VRSHRN on page A8-1037.
The operand elements can be 16-bit, 32-bit, or 64-bit integers. There is no distinction between signed and unsigned
integers. The destination elements are half the size of the source elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D imm6 Vd 1 0 0 0 0 0 M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D imm6 Vd 1 0 0 0 0 0 M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1055
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSHRN instruction must be
unconditional. ARM strongly recommends that a Thumb VSHRN instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
16 Encoded as imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
32 Encoded as imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
64 Encoded as imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
<imm> The immediate value, in the range 1 to <size>/2. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
result = LSR(Elem[Qin[m>>1],e,2*esize], shift_amount);
Elem[D[d],e,esize] = result<esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
A8-1056 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.401 VSLI
Vector Shift Left and Insert takes each element in the operand vector, left shifts them by an immediate value, and
inserts the results in the destination vector. Bits shifted out of the left of each element are lost.
The elements must all be the same size, and can be 8-bit, 16-bit, 32-bit, or 64-bit. There is no distinction between
data types.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D imm6 Vd 0 1 0 1 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D imm6 Vd 0 1 0 1 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1057
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSLI instruction must be
unconditional. ARM strongly recommends that a Thumb VSLI instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. <imm> is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. <imm> is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. <imm> is encoded in imm6<4:0>.
64 Encoded as L = 1. <imm> is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 0 to <size>-1. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
mask = LSL(Ones(esize), shift_amount);
for r = 0 to regs-1
for e = 0 to elements-1
shifted_op = LSL(Elem[D[m+r],e,esize], shift_amount);
Elem[D[d+r],e,esize] = (Elem[D[d+r],e,esize] AND NOT(mask)) OR shifted_op;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1058 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.402 VSQRT
This instruction calculates the square root of the value in a floating-point register and writes the result to another
floating-point register.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 summarizes these controls.
Encoding T1/A1 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VSQRT<c>.F64 <Dd>, <Dm>
VSQRT<c>.F32 <Sd>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 1 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 1 D 1 1 0 0 0 1 Vd 1 0 1 sz 1 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors This instruction can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1059
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VSQRT{<c>}{<q>}.F64 <Dd>, <Dm> Encoded as sz = 1
VSQRT{<c>}{<q>}.F32 <Sd>, <Sm> Encoded as sz = 0
where:
<Dd>, <Dm> The destination vector and the operand vector, for a double-precision operation.
<Sd>, <Sm> The destination vector and the operand vector, for a single-precision operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE);
if dp_operation then
D[d] = FPSqrt(D[m]);
else
S[d] = FPSqrt(S[m]);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-1060 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.403 VSRA
Vector Shift Right and Accumulate takes each element in a vector, right shifts them by an immediate value, and
accumulates the truncated results into the destination vector. (For rounded results, see VRSRA on page A8-1043.)
The operand and result elements must all be the same type, and can be any one of:
• 8-bit, 16-bit, 32-bit, or 64-bit signed integers.
• 8-bit, 16-bit, 32-bit, or 64-bit unsigned integers.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D imm6 Vd 0 0 0 1 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D imm6 Vd 0 0 0 1 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1061
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSRA instruction must be
unconditional. ARM strongly recommends that a Thumb VSRA instruction is unconditional, see
Conditional execution on page A8-286.
<type> The data type for the elements of the vectors. It must be one of:
S Signed, encoded as U = 0.
U Unsigned, encoded as U = 1.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
64 Encoded as L = 1. (64 – <imm>) is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 1 to <size>. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
result = Int(Elem[D[m+r],e,esize], unsigned) >> shift_amount;
Elem[D[d+r],e,esize] = Elem[D[d+r],e,esize] + result;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1062 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.404 VSRI
Vector Shift Right and Insert takes each element in the operand vector, right shifts them by an immediate value, and
inserts the results in the destination vector. Bits shifted out of the right of each element are lost.
The elements must all be the same size, and can be 8-bit, 16-bit, 32-bit, or 64-bit. There is no distinction between
data types.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D imm6 Vd 0 1 0 0 L Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D imm6 Vd 0 1 0 0 L Q M 1 Vm
Related encodings See One register and a modified immediate value on page A7-267.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1063
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSRI instruction must be
unconditional. ARM strongly recommends that a Thumb VSRI instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as L = 0, imm6<5:3> = 0b001. (8 – <imm>) is encoded in imm6<2:0>.
16 Encoded as L = 0, imm6<5:4> = 0b01. (16 – <imm>) is encoded in imm6<3:0>.
32 Encoded as L = 0, imm6<5> = 0b1. (32 – <imm>) is encoded in imm6<4:0>.
64 Encoded as L = 1. (64 – <imm>) is encoded in imm6<5:0>.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
<imm> The immediate value, in the range 1 to <size>. See the description of <size> for how <imm> is
encoded.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
mask = LSR(Ones(esize), shift_amount);
for r = 0 to regs-1
for e = 0 to elements-1
shifted_op = LSR(Elem[D[m+r],e,esize], shift_amount);
Elem[D[d+r],e,esize] = (Elem[D[d+r],e,esize] AND NOT(mask)) OR shifted_op;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1064 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 0 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd type size align Rm
case type of
when ‘0111’
regs = 1; if align<1> == ‘1’ then UNDEFINED;
when ‘1010’
regs = 2; if align == ‘11’ then UNDEFINED;
when ‘0110’
regs = 3; if align<1> == ‘1’ then UNDEFINED;
when ‘0010’
regs = 4;
otherwise
SEE “Related encodings”;
alignment = if align == ‘00’ then 1 else 4 << UInt(align);
ebytes = 1 << UInt(size); esize = 8 * ebytes; elements = 8 DIV ebytes;
d = UInt(D:Vd); n = UInt(Rn); m = UInt(Rm);
wback = (m != 15); register_index = (m != 15 && m != 13);
if n == 15 || d+regs > 32 then UNPREDICTABLE;
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST1 instruction must be
unconditional. ARM strongly recommends that a Thumb VST1 instruction is unconditional, see
Conditional execution on page A8-286.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1065
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
for r = 0 to regs-1
for e = 0 to elements - 1
if ebytes != 8 then
MemU[address, ebytes] = Elem[D[d+r], e, esize];
else
if SCTLR.A == ‘1’ && address != Align(address, 8) then AlignmentFault(address, FALSE);
data = Elem[D[d+r], e, esize];
MemU[address, 4] = if BigEndian() then data<63:32> else data<31:0>;
MemU[address+4, 4] = if BigEndian() then data<31:0> else data<63:32>;
address = address + ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 8*regs);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1066 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 0 0 Rn Vd size 0 0 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 0 index_align Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1067
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST1 instruction must be
unconditional. ARM strongly recommends that a Thumb VST1 instruction is unconditional, see
Conditional execution on page A8-286.
<list> The register containing the element to store. It must be {<Dd[x]>}. The register Dd is encoded in D:Vd
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Table A8-9 shows the encoding of index and alignment for different <size> values.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
MemU[address,ebytes] = Elem[D[d], index, esize];
if wback then R[n] = R[n] + (if register_index then R[m] else ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1068 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 0 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd type size align Rm
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1069
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST2 instruction must be
unconditional. ARM strongly recommends that a Thumb VST2 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
for r = 0 to regs-1
for e = 0 to elements-1
MemU[address, ebytes] = Elem[D[d+r], e, esize];
MemU[address+ebytes, ebytes] = Elem[D[d2+r],e, esize];
address = address + 2*ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 16*regs);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1070 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 0 0 Rn Vd size 0 1 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 0 1 index_align Rm
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST2 instruction must be
unconditional. ARM strongly recommends that a Thumb VST2 instruction is unconditional, see
Conditional execution on page A8-286.
<list> The registers containing the structure. Encoded with D:Vd = <Dd>. It must be one of:
{<Dd[x]>, <Dd+1[x]>} Single-spaced registers, see Table A8-10 on page A8-1072.
{<Dd[x]>, <Dd+2[x]>} Double-spaced registers, see Table A8-10 on page A8-1072. This is not
available if <size> == 8.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1071
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
<align> == 16 index_align[0] = 1 - -
<align> == 32 - index_align[0] = 1 -
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
MemU[address, ebytes] = Elem[D[d], index, esize];
MemU[address+ebytes, ebytes] = Elem[D[d2], index, esize];
if wback then R[n] = R[n] + (if register_index then R[m] else 2*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1072 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 0 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd type size align Rm
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1073
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST3 instruction must be
unconditional. ARM strongly recommends that a Thumb VST3 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
for e = 0 to elements-1
MemU[address, ebytes] = Elem[D[d], e, esize];
MemU[address+ebytes, ebytes] = Elem[D[d2], e, esize];
MemU[address+2*ebytes, ebytes] = Elem[D[d3], e, esize];
address = address + 3*ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 24);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1074 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 0 0 Rn Vd size 1 0 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 1 0 index_align Rm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1075
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST3 instruction must be
unconditional. ARM strongly recommends that a Thumb VST3 instruction is unconditional, see
Conditional execution on page A8-286.
<list> The registers containing the structure. Encoded with D:Vd = <Dd>. It must be one of:
{<Dd[x]>, <Dd+1[x]>, <Dd+2[x]>}
Single-spaced registers, see Table A8-11.
{<Dd[x]>, <Dd+2[x]>, <Dd+4[x]>}
Double-spaced registers, see Table A8-11. This is not available if <size> == 8.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Alignment
Standard alignment rules apply, see Unaligned data access on page A3-106.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n];
MemU[address, ebytes] = Elem[D[d], index, esize];
MemU[address+ebytes, ebytes] = Elem[D[d2], index, esize];
MemU[address+2*ebytes, ebytes] = Elem[D[d3], index, esize];
if wback then R[n] = R[n] + (if register_index then R[m] else 3*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1076 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 0 D 0 0 Rn Vd type size align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 0 D 0 0 Rn Vd type size align Rm
Related encodings See Advanced SIMD element or structure load/store instructions on page A7-273.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1077
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST4 instruction must be
unconditional. ARM strongly recommends that a Thumb VST4 instruction is unconditional, see
Conditional execution on page A8-286.
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
for e = 0 to elements-1
MemU[address, ebytes] = Elem[D[d], e, esize];
MemU[address+ebytes, ebytes] = Elem[D[d2], e, esize];
MemU[address+2*ebytes, ebytes] = Elem[D[d3], e, esize];
MemU[address+3*ebytes, ebytes] = Elem[D[d4], e, esize];
address = address + 4*ebytes;
if wback then R[n] = R[n] + (if register_index then R[m] else 32);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1078 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 0 1 1 D 0 0 Rn Vd size 1 1 index_align Rm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 1 0 0 1 D 0 0 Rn Vd size 1 1 index_align Rm
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VST4 instruction must be
unconditional. ARM strongly recommends that a Thumb VST4 instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
<list> The registers containing the structure. Encoded with D:Vd = <Dd>. It must be one of:
{<Dd[x]>, <Dd+1[x]>, <Dd+2[x]>, <Dd+3[x]>}
Single-spaced registers, see Table A8-12 on page A8-1080.
{<Dd[x]>, <Dd+2[x]>, <Dd+4[x]>, <Dd+6[x]>}
Double-spaced registers, see Table A8-12 on page A8-1080. This is not available if
<size> == 8.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1079
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
For more information about <Rn>, !, and <Rm>, see Advanced SIMD addressing mode on page A7-275.
<align> == 32 index_align[0] = 1 - -
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n);
address = R[n]; if (address MOD alignment) != 0 then AlignmentFault(address, TRUE);
MemU[address, ebytes] = Elem[D[d], index, esize];
MemU[address+ebytes, ebytes] = Elem[D[d2], index, esize];
MemU[address+2*ebytes, ebytes] = Elem[D[d3], index, esize];
MemU[address+3*ebytes, ebytes] = Elem[D[d4], index, esize];
if wback then R[n] = R[n] + (if register_index then R[m] else 4*ebytes);
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1080 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.413 VSTM
Vector Store Multiple stores multiple extension registers to consecutive memory locations using an address from an
ARM core register.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 0 Rn Vd 1 0 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 0 Rn Vd 1 0 1 1 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 P U D W 0 Rn Vd 1 0 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 P U D W 0 Rn Vd 1 0 1 0 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
Related encodings See 64-bit transfers between ARM core and extension registers on page A7-277.
FSTMX Encoding T1/A1 behaves as described by the pseudocode if imm8 is odd. However, there is
no UAL syntax for such encodings and ARM deprecates their use. For more information, see
FLDMX, FSTMX on page A8-389.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1081
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VSTM{<mode>}{<c>}{<q>}{.<size>} <Rn>{!}, <list>
where:
<size> An optional data size specifier. If present, it must be equal to the size in bits, 32 or 64, of the registers
in <list>.
<Rn> The base register. The SP can be used. In the ARM instruction set, if ! is not specified the PC can
be used. However, ARM deprecates use of the PC.
! Causes the instruction to write a modified value back to <Rn>. Required if <mode> == DB. Encoded
as W = 1.
If ! is omitted, the instruction does not change <Rn> in this way. Encoded as W = 0.
<list> The extension registers to be stored, as a list of consecutively numbered doubleword (encoding
T1/A1) or singleword (encoding T2/A2) registers, separated by commas and surrounded by
brackets. It is encoded in the instruction by setting D and Vd to specify the first register in the list,
and imm8 to twice the number of registers in the list (encoding T1/A1) or the number of registers
(encoding T2/A2). <list> must contain at least one register. If it contains doubleword registers it
must not contain more than 16 registers.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(n);
address = if add then R[n] else R[n]-imm32;
for r = 0 to regs-1
if single_regs then
MemA[address,4] = S[d+r]; address = address+4;
else
// Store as two word-aligned words in the correct order for current endianness.
MemA[address,4] = if BigEndian() then D[d+r]<63:32> else D[d+r]<31:0>;
MemA[address+4,4] = if BigEndian() then D[d+r]<31:0> else D[d+r]<63:32>;
address = address+8;
if wback then R[n] = if add then R[n]+imm32 else R[n]-imm32;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1082 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.414 VSTR
This instruction stores a single extension register to memory, using an address from an ARM core register, with an
optional offset.
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 U D 0 0 Rn Vd 1 0 1 1 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 1 U D 0 0 Rn Vd 1 0 1 1 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 0 1 U D 0 0 Rn Vd 1 0 1 0 imm8
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 0 1 U D 0 0 Rn Vd 1 0 1 0 imm8
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1083
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<Rn> The base register. The SP can be used. In the ARM instruction set the PC can be used. However,
ARM deprecates use of the PC.
+/- Is + or omitted if the immediate offset is to be added to the base register value (add == TRUE), or – if
it is to be subtracted (add == FALSE). #0 and #-0 generate different instructions.
<imm> The immediate offset used for forming the address. Values are multiples of 4 in the range 0-1020.
<imm> can be omitted, meaning an offset of +0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckVFPEnabled(TRUE); NullCheckIfThumbEE(n);
address = if add then (R[n] + imm32) else (R[n] - imm32);
if single_reg then
MemA[address,4] = S[d];
else
// Store as two word-aligned words in the correct order for current endianness.
MemA[address,4] = if BigEndian() then D[d]<63:32> else D[d]<31:0>;
MemA[address+4,4] = if BigEndian() then D[d]<31:0> else D[d]<63:32>;
Exceptions
Undefined Instruction, Hyp Trap, Data Abort.
A8-1084 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 0 D size Vn Vd 1 0 0 0 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 0 D size Vn Vd 1 0 0 0 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1085
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VSUB{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Qm>
VSUB{<c>}{<q>}.<dt> {<Dd>,} <Dn>, <Dm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VSUB
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VSUB instruction is unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the vectors. It must be one of:
I8 Encoded as size = 0b00.
I16 Encoded as size = 0b01.
I32 Encoded as size = 0b10.
I64 Encoded as size = 0b11.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = Elem[D[n+r],e,esize] - Elem[D[m+r],e,esize];
Exceptions
Undefined Instruction, Hyp Trap.
A8-1086 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Depending on settings in the CPACR, NSACR, HCPTR, and FPEXC registers, and the security state and mode in
which the instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp
mode. Summary of general controls of CP10 and CP11 functionality on page B1-1230 and Summary of access
controls for Advanced SIMD functionality on page B1-1232 summarize these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D 1 sz Vn Vd 1 1 0 1 N Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D 1 sz Vn Vd 1 1 0 1 N Q M 0 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if sz == ‘1’ then UNDEFINED;
advsimd = TRUE; esize = 32; elements = 2;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
Encoding T2/A2 VFPv2, VFPv3, VFPv4 (sz = 1 UNDEFINED in single-precision only variants)
VSUB<c>.F64 <Dd>, <Dn>, <Dm>
VSUB<c>.F32 <Sd>, <Sn>, <Sm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 1 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 1 1 1 0 0 D 1 1 Vn Vd 1 0 1 sz N 1 M 0 Vm
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
VFP vectors Encoding T2/A2 can operate on VFP vectors under control of the FPSCR.{Len, Stride} fields.
For details see Appendix D11 VFP Vector Operation Support.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1087
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VSUB{<c>}{<q>}.F32 {<Qd>,} <Qn>, <Qm> Encoding T1/A1, encoded as Q = 1, sz = 0
VSUB{<c>}{<q>}.F32 {<Dd>,} <Dn>, <Dm> Encoding T1/A1, encoded as Q = 0, sz = 0
VSUB{<c>}{<q>}.F64 {<Dd>,} <Dn>, <Dm> Encoding T2/A2, encoded as sz = 1
VSUB{<c>}{<q>}.F32 {<Sd>,} <Sn>, <Sm> Encoding T2/A2, encoded as sz = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM Advanced SIMD VSUB
instruction must be unconditional. ARM strongly recommends that a Thumb Advanced
SIMD VSUB instruction is unconditional, see Conditional execution on page A8-286.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
<Sd>, <Sn>, <Sm> The destination vector and the operand vectors, for a singleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDOrVFPEnabled(TRUE, advsimd);
if advsimd then // Advanced SIMD instruction
for r = 0 to regs-1
for e = 0 to elements-1
Elem[D[d+r],e,esize] = FPSub(Elem[D[n+r],e,esize], Elem[D[m+r],e,esize], FALSE);
else // VFP instruction
if dp_operation then
D[d] = FPSub(D[n], D[m], TRUE);
else
S[d] = FPSub(S[n], S[m], TRUE);
Exceptions
Undefined Instruction, Hyp Trap.
Floating-point exceptions
A8-1088 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.417 VSUBHN
Vector Subtract and Narrow, returning High Half subtracts the elements of one quadword vector from the
corresponding elements of another quadword vector, takes the most significant half of each result, and places the
final results in a doubleword vector. The results are truncated. (For rounded results, see VRSUBHN on
page A8-1045.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 1 D size Vn Vd 0 1 1 0 N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1089
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VSUBHN{<c>}{<q>}.<dt> <Dd>, <Qn>, <Qm>
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSUBHN instruction must be
unconditional. ARM strongly recommends that a Thumb VSUBHN instruction is
unconditional, see Conditional execution on page A8-286.
<dt> The data type for the elements of the operands. It must be one of:
I16 Encoded as size = 0b00.
I32 Encoded as size = 0b01.
I64 Encoded as size = 0b10.
<Dd>, <Qn>, <Qm> The destination vector, the first operand vector, and the second operand vector.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
result = Elem[Qin[n>>1],e,2*esize] - Elem[Qin[m>>1],e,2*esize];
Elem[D[d],e,esize] = result<2*esize-1:esize>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1090 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Subtract Wide subtracts the elements of a doubleword vector from the corresponding elements of a quadword
vector, and places the results in another quadword vector. Before subtracting, it sign-extends or zero-extends the
elements of the doubleword operand.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 U 1 1 1 1 1 D size Vn Vd 0 0 1 op N 0 M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 U 1 D size Vn Vd 0 0 1 op N 0 M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1091
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VSUBL{<c>}{<q>}.<dt> <Qd>, <Dn>, <Dm> Encoded as op = 0
VSUBW{<c>}{<q>}.<dt> {<Qd>,} <Qn>, <Dm> Encoded as op = 1
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSUBL or VSUBW instruction must be
unconditional. ARM strongly recommends that a Thumb VSUBL or VSUBW instruction is unconditional,
see Conditional execution on page A8-286.
<dt> The data type for the elements of the second operand. It must be one of:
S8 Encoded as size = 0b00, U = 0.
S16 Encoded as size = 0b01, U = 0.
S32 Encoded as size = 0b10, U = 0.
U8 Encoded as size = 0b00, U = 1.
U16 Encoded as size = 0b01, U = 1.
U32 Encoded as size = 0b10, U = 1.
<Qn>, <Dm> The first and second operand registers for a VSUBW instruction.
<Dn>, <Dm> The first and second operand registers for a VSUBL instruction.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for e = 0 to elements-1
if is_vsubw then
op1 = Int(Elem[Qin[n>>1],e,2*esize], unsigned);
else
op1 = Int(Elem[Din[n],e,esize], unsigned);
result = op1 - Int(Elem[Din[m],e,esize], unsigned);
Elem[Q[d>>1],e,2*esize] = result<2*esize-1:0>;
Exceptions
Undefined Instruction, Hyp Trap.
A8-1092 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.419 VSWP
VSWP (Vector Swap) exchanges the contents of two vectors. The vectors can be either doubleword or quadword.
There is no distinction between data types.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 0 0 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 0 0 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1093
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VSWP instruction must be
unconditional. ARM strongly recommends that a Thumb VSWP instruction is unconditional, see
Conditional execution on page A8-286.
<dt> An optional data type. It is ignored by assemblers, and does not affect the encoding.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
if d == m then
D[d+r] = bits(64) UNKNOWN;
else
D[d+r] = Din[m+r];
D[m+r] = Din[d+r];
Exceptions
Undefined Instruction, Hyp Trap.
A8-1094 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Vector Table Extension works in the same way, except that indexes out of range leave the destination element
unchanged.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 Vn Vd 1 0 len N op M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 Vn Vd 1 0 len N op M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1095
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VTBL or VTBX instruction must be
unconditional. ARM strongly recommends that a Thumb VTBL or VTBX instruction is unconditional,
see Conditional execution on page A8-286.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
// Create 256-bit = 32-byte table variable, with zeros in entries that will not be used.
table3 = if length == 4 then D[n+3] else Zeros(64);
table2 = if length >= 3 then D[n+2] else Zeros(64);
table1 = if length >= 2 then D[n+1] else Zeros(64);
table = table3 : table2 : table1 : D[n];
for i = 0 to 7
index = UInt(Elem[D[m],i,8]);
if index < 8*length then
Elem[D[d],i,8] = Elem[table,index,8];
else
if is_vtbl then
Elem[D[d],i,8] = Zeros(8);
// else Elem[D[d],i,8] unchanged
Exceptions
Undefined Instruction, Hyp Trap.
A8-1096 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.421 VTRN
Vector Transpose treats the elements of its operand vectors as elements of 2 × 2 matrices, and transposes the
matrices.
The elements of the vectors can be 8-bit, 16-bit, or 32-bit. There is no distinction between data types.
Figure A8-7 shows the operation of doubleword VTRN. Quadword VTRN performs the same operation as doubleword
VTRN twice, once on the upper halves of the quadword vectors, and once on the lower halves
Dm Dm Dm
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 0 0 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 0 1 Q M 0 Vm
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1097
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VTRN instruction must be
unconditional. ARM strongly recommends that a Thumb VTRN instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
<Qd>, <Qm> The destination vector, and the operand vector, for a quadword operation.
<Dd>, <Dm> The destination vector, and the operand vector, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
h = elements DIV 2;
for r = 0 to regs-1
if d == m then
D[d+r] = bits(64) UNKNOWN;
else
for e = 0 to h-1
Elem[D[d+r],2*e+1,esize] = Elem[Din[m+r],2*e,esize];
Elem[D[m+r],2*e,esize] = Elem[Din[d+r],2*e+1,esize];
Exceptions
Undefined Instruction, Hyp Trap.
A8-1098 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.422 VTST
Vector Test Bits takes each element in a vector, and bitwise ANDs it with the corresponding element of a second
vector. If the result is not zero, the corresponding element in the destination vector is set to all ones. Otherwise, it is
set to all zeros.
The result vector elements are fields the same size as the operand vector elements.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 0 1 1 1 1 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 0 0 D size Vn Vd 1 0 0 0 N Q M 1 Vm
if Q == ‘1’ && (Vd<0> == ‘1’ || Vn<0> == ‘1’ || Vm<0> == ‘1’) then UNDEFINED;
if size == ‘11’ then UNDEFINED;
esize = 8 << UInt(size); elements = 64 DIV esize;
d = UInt(D:Vd); n = UInt(N:Vn); m = UInt(M:Vm); regs = if Q == ‘0’ then 1 else 2;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1099
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
VTST{<c>}{<q>}.<size> {<Qd>,} <Qn>, <Qm> Encoded as Q = 1
VTST{<c>}{<q>}.<size> {<Dd>,} <Dn>, <Dm> Encoded as Q = 0
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VTST instruction must be
unconditional. ARM strongly recommends that a Thumb VTST instruction is unconditional,
see Conditional execution on page A8-286.
<size> The data size for the elements of the operands. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10.
<Qd>, <Qn>, <Qm> The destination vector and the operand vectors, for a quadword operation.
<Dd>, <Dn>, <Dm> The destination vector and the operand vectors, for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
for r = 0 to regs-1
for e = 0 to elements-1
if !IsZero(Elem[D[n+r],e,esize] AND Elem[D[m+r],e,esize]) then
Elem[D[d+r],e,esize] = Ones(esize);
else
Elem[D[d+r],e,esize] = Zeros(esize);
Exceptions
Undefined Instruction, Hyp Trap.
A8-1100 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.423 VUZP
Vector Unzip de-interleaves the elements of two vectors. See Table A8-13 and Table A8-14 for examples of the
operation.
The elements of the vectors can be 8-bit, 16-bit, or 32-bit. There is no distinction between data types.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 0 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 0 Q M 0 Vm
Table A8-13 shows the operation of a doubleword VUZP.8 instruction, and Table A8-14 shows the operation of a
quadword VUZP.32 instruction, and
Dd A7 A6 A5 A4 A3 A2 A1 A0 B6 B4 B2 B0 A6 A4 A2 A0
Dm B7 B6 B5 B4 B3 B2 B1 B0 B7 B5 B3 B1 A7 A5 A3 A1
Qd A3 A2 A1 A0 B2 B0 A2 A0
Qm B3 B2 B1 B0 B3 B1 A3 A1
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1101
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VUZP instruction must be
unconditional. ARM strongly recommends that a Thumb VUZP instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10 for a quadword operation.
Doubleword operation with <size> = 32 is a pseudo-instruction.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
if quadword_operation then
if d == m then
Q[d>>1] = bits(128) UNKNOWN; Q[m>>1] = bits(128) UNKNOWN;
else
zipped_q = Q[m>>1]:Q[d>>1];
for e = 0 to (128 DIV esize) - 1
Elem[Q[d>>1],e,esize] = Elem[zipped_q,2*e,esize];
Elem[Q[m>>1],e,esize] = Elem[zipped_q,2*e+1,esize];
else
if d == m then
D[d] = bits(64) UNKNOWN; D[m] = bits(64) UNKNOWN;
else
zipped_d = D[m]:D[d];
for e = 0 to (64 DIV esize) - 1
Elem[D[d],e,esize] = Elem[zipped_d,2*e,esize];
Elem[D[m],e,esize] = Elem[zipped_d,2*e+1,esize];
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instruction
VUZP.32 <Dd>, <Dm> is a synonym for VTRN.32 <Dd>, <Dm>. For details see VTRN on page A8-1097.
A8-1102 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.424 VZIP
Vector Zip interleaves the elements of two vectors. See Table A8-15 and Table A8-16 for examples of the operation.
The elements of the vectors can be 8-bit, 16-bit, or 32-bit. There is no distinction between data types.
Depending on settings in the CPACR, NSACR, and HCPTR registers, and the security state and mode in which the
instruction is executed, an attempt to execute the instruction might be UNDEFINED, or trapped to Hyp mode.
Summary of access controls for Advanced SIMD functionality on page B1-1232 summarizes these controls.
ARM deprecates the conditional execution of any Advanced SIMD instruction encoding that is not also available
as a VFP instruction encoding, see Conditional execution on page A8-286.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 1 Q M 0 Vm
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 D 1 1 size 1 0 Vd 0 0 0 1 1 Q M 0 Vm
Table A8-15 shows the operation of a doubleword VZIP.8 instruction, and Table A8-16 shows the operation of a
quadword VZIP.32 instruction.
Dd A7 A6 A5 A4 A3 A2 A1 A0 B3 A3 B2 A2 B1 A1 B0 A0
Dm B7 B6 B5 B4 B3 B2 B1 B0 B7 A7 B6 A6 B5 A5 B4 A4
Qd A3 A2 A1 A0 B1 A1 B0 A0
Qm B3 B2 B1 B0 B3 A3 B2 A2
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1103
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
where:
<c>, <q> See Standard assembler syntax fields on page A8-285. An ARM VZIP instruction must be
unconditional. ARM strongly recommends that a Thumb VZIP instruction is unconditional, see
Conditional execution on page A8-286.
<size> The data size for the elements of the vectors. It must be one of:
8 Encoded as size = 0b00.
16 Encoded as size = 0b01.
32 Encoded as size = 0b10 for a quadword operation.
Doubleword operation with <size> = 32 is a pseudo-instruction.
<Qd>, <Qm> The vectors for a quadword operation.
<Dd>, <Dm> The vectors for a doubleword operation.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); CheckAdvSIMDEnabled();
if quadword_operation then
if d == m then
Q[d>>1] = bits(128) UNKNOWN; Q[m>>1] = bits(128) UNKNOWN;
else
bits(256) zipped_q;
for e = 0 to (128 DIV esize) - 1
Elem[zipped_q,2*e,esize] = Elem[Q[d>>1],e,esize];
Elem[zipped_q,2*e+1,esize] = Elem[Q[m>>1],e,esize];
Q[d>>1] = zipped_q<127:0>; Q[m>>1] = zipped_q<255:128>;
else
if d == m then
D[d] = bits(64) UNKNOWN; D[m] = bits(64) UNKNOWN;
else
bits(128) zipped_d;
for e = 0 to (64 DIV esize) - 1
Elem[zipped_d,2*e,esize] = Elem[D[d],e,esize];
Elem[zipped_d,2*e+1,esize] = Elem[D[m],e,esize];
D[d] = zipped_d<63:0>; D[m] = zipped_d<127:64>;
Exceptions
Undefined Instruction, Hyp Trap.
Pseudo-instructions
VZIP.32 <Dd>, <Dm> is a synonym for VTRN.32 <Dd>, <Dm>. For details see VTRN on page A8-1097.
A8-1104 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.425 WFE
Wait For Event is a hint instruction that permits the processor to enter a low-power state until one of a number of
events occurs, including events signaled by executing the SEV instruction on any processor in the multiprocessor
system. For more information, see Wait For Event and Send Event on page B1-1199.
In an implementation that includes the Virtualization Extensions, if HCR.TWE is set to 1, execution of a WFE
instruction in a Non-secure mode other than Hyp mode generates a Hyp Trap exception if, ignoring the value of the
HCR.TWE bit, conditions permit the processor to suspend execution. For more information see Trapping use of the
WFI and WFE instructions on page B1-1253.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 0 0 1 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 0 0 0 0 0 0 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 0 1 0
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1105
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
WFE{<c>}{<q>}
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if EventRegistered() then
ClearEventRegister();
else
if HaveVirtExt() && !IsSecure() && !CurrentModeIsHyp() && HCR.TWE == ‘1’ then
HSRString = Zeros(25);
HSRString<0> = ‘1’;
WriteHSR(‘000001’, HSRString);
TakeHypTrapException();
else
WaitForEvent();
Exceptions
Hyp Trap.
A8-1106 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.426 WFI
Wait For Interrupt is a hint instruction that permits the processor to enter a low-power state until one of a number
of asynchronous events occurs. For more information, see Wait For Interrupt on page B1-1202.
In an implementation that includes the Virtualization Extensions, if HCR.TWI is set to 1, execution of a WFI
instruction in a Non-secure mode other than Hyp mode generates a Hyp Trap exception if, ignoring the value of the
HCR.TWI bit, conditions permit the processor to suspend execution. For more information see Trapping use of the
WFI and WFE instructions on page B1-1253.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 0 0 1 1 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 0 0 0 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 0 1 1
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1107
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
WFI{<c>}{<q>}
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if HaveVirtExt() && !IsSecure() && !CurrentModeIsHyp() && HCR.TWI == ‘1’ then
HSRString = Zeros(25);
HSRString<0> = ‘0’;
WriteHSR(‘000001’, HSRString);
TakeHypTrapException();
else
WaitForInterrupt();
Exceptions
Hyp Trap.
A8-1108 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
A8.8.427 YIELD
YIELD is a hint instruction. Software with a multithreading capability can use a YIELD instruction to indicate to the
hardware that it is performing a task, for example a spin-lock, that could be swapped out to improve overall system
performance. Hardware can use this hint to suspend and resume multiple software threads if it supports the
capability.
For more information about the recommended use of this instruction see The Yield instruction on page A4-176.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 0 (1) (1) (1) (1) 1 0 (0) 0 (0) 0 0 0 0 0 0 0 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cond 0 0 1 1 0 0 1 0 0 0 0 0 (1) (1) (1) (1) (0) (0) (0) (0) 0 0 0 0 0 0 0 1
For the case when cond is 0b1111, see Unconditional instructions on page A5-214.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A8-1109
ID040418 Non-Confidential
A8 Instruction Descriptions
A8.8 Alphabetical list of instructions
Assembler syntax
YIELD{<c>}{<q>}
where:
Operation
if ConditionPassed() then
EncodingSpecificOperations();
Hint_Yield();
Exceptions
None.
A8-1110 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter A9
The ThumbEE Instruction Set
This chapter describes the ThumbEE instruction set. It contains the following sections:
• About the ThumbEE instruction set on page A9-1112
• ThumbEE instruction set encoding on page A9-1115
• Additional instructions in Thumb and ThumbEE instruction sets on page A9-1116
• ThumbEE instructions with modified behavior on page A9-1117
• Additional ThumbEE instructions on page A9-1123.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1111
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.1 About the ThumbEE instruction set
• A small number of instructions are affected by modifications to transitions from ThumbEE state. For more
information, see ThumbEE state transitions.
• A substantial number of instructions have a null check on the base register before any other operation takes
place, but are identical (or almost identical) in all other respects. For more information, see Null checking on
page A9-1113.
• A small number of instructions are modified in additional ways. See Instructions with modifications on
page A9-1113.
• Three Thumb instructions, BLX (immediate), 16-bit LDM, and 16-bit STM, are removed in ThumbEE state.
The encoding corresponding to BLX (immediate) in Thumb is UNDEFINED in ThumbEE state.
16-bit LDM and STM are replaced by new instructions, for details see Additional ThumbEE instructions on
page A9-1123.
• Two new 32-bit instructions, ENTERX and LEAVEX, are introduced in both the Thumb instruction set and the
ThumbEE instruction set. See Additional instructions in Thumb and ThumbEE instruction sets on
page A9-1116. These instructions use previously UNDEFINED encodings.
Attempting to execute ThumbEE instructions at PL2 is UNPREDICTABLE.
From the publication of issue C.a of this manual, ARM deprecates any use of the ThumbEE instruction set.
Any other Thumb instructions that can update the PC in ThumbEE state are UNPREDICTABLE if they attempt to
change to ARM state. Interworking of ARM and Thumb instructions is not supported in ThumbEE state. The
instructions affected are:
• LDR, LDM, and POP instructions that write to the PC, if bit[0] of the value loaded to the PC is 0
• BLX (register), BX, and BXJ, where Rm bit[0] == 0.
Note
SVC, BKPT, and UNDEFINED instructions cause an exception to occur.
If a BXJ <Rm> instruction is executed in ThumbEE state, with Rm bit[0] == 1, it does not enter Jazelle state. Instead,
it behaves like the corresponding BX <Rm> instruction and remains in ThumbEE state.
Debug state is a special case. For the rules governing changes to CPSR state bits and Debug state, see Executing
instructions in Debug state on page C5-2084.
A9-1112 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.1 About the ThumbEE instruction set
For most load/store instructions, this is the only difference from normal Thumb operation. Exceptions to this rule
are described in this chapter.
Note
• The null check examines the value in the base register, not any calculated value offset from the base register.
• If the base register is the SP or the PC, a zero value in the base register results in UNPREDICTABLE behavior.
• RFE and SRS instructions do not require null checking because they have UNPREDICTABLE behavior when
executed in ThumbEE state.
For each of these instructions, the pseudocode shown in the Operation section uses the following function:
// NullCheckIfThumbEE()
// ====================
NullCheckIfThumbEE(integer n)
if CurrentInstrSet() == InstrSet_ThumbEE then
if n == 15 then
if IsZero(Align(PC,4)) then UNPREDICTABLE;
elsif n == 13 then
if IsZero(SP) then UNPREDICTABLE;
else
if IsZero(R[n]) then
LR = PC<31:1> : '1'; // PC holds this instruction's address plus 4
ITSTATE.IT = '00000000';
BranchWritePC(TEEHBR - 4);
EndOfInstruction();
return;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1113
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.1 About the ThumbEE instruction set
A9-1114 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.2 ThumbEE instruction set encoding
• There are no 16-bit LDM or STM instructions in the ThumbEE instruction set.
• The 16-bit encodings used for LDM and STM in the Thumb instruction set are used for different 16-bit
instructions in the ThumbEE instruction set. For details, see 16-bit ThumbEE instructions.
• There are two new 32-bit instructions in both Thumb state and ThumbEE state. For details, see Additional
instructions in Thumb and ThumbEE instruction sets on page A9-1116.
0001 UNDEFINED -
001x Handler Branch, Handler Branch with Link HB, HBL on page A9-1125
01xx Handler Branch with Link and Parameter HBLP on page A9-1126
1011 Load Register from a literal pool LDR (immediate) on page A9-1128
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1115
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.3 Additional instructions in Thumb and ThumbEE instruction sets
LEAVEX causes a change from ThumbEE state to Thumb state, or has no effect in Thumb state.
Encoding T1 ThumbEE
ENTERX Not permitted in IT block.
LEAVEX Not permitted in IT block.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 0 0 1 1 1 0 1 1 (1) (1) (1) (1) 1 0 (0) 0 (1) (1) (1) (1) 0 0 0 J (1) (1) (1) (1)
is_enterx = (J == '1');
if InITBlock() then UNPREDICTABLE;
Assembler syntax
ENTERX{<q>} Encoded as J = 1
LEAVEX{<q>} Encoded as J = 0
where:
<q> See Standard assembler syntax fields on page A8-285. An ENTERX or LEAVEX instruction must be
unconditional.
Operation
if is_enterx then
if CurrentModeIsHyp() then
UNDEFINED;
else
SelectInstrSet(InstrSet_ThumbEE);
else
SelectInstrSet(InstrSet_Thumb);
Exceptions
None.
A9-1116 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.4 ThumbEE instructions with modified behavior
In ThumbEE state there are the following changes in the behavior of instructions:
• All load/store instructions perform null checks on their base register values, as described in Null checking on
page A9-1113. The pseudocode for these instructions in Chapter A8 Instruction Descriptions describes this
by calling the NullCheckIfThumbEE() pseudocode procedure.
• Instructions that attempt to enter ARM state are UNPREDICTABLE, as described in ThumbEE state transitions
on page A9-1112. The pseudocode for these instructions in Chapter A8 Instruction Descriptions describes
this by calling the SelectInstrSet() or BXWritePC() pseudocode procedure.
• The BXJ instruction behaves like the BX instruction, as described in ThumbEE state transitions on
page A9-1112. The pseudocode for the instruction, in BXJ on page A8-352, describes this directly.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1117
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.4 ThumbEE instructions with modified behavior
Encoding T1 ThumbEE
LDR<c> <Rt>, [<Rn>, <, <Rm>, LSL #2]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 Rm Rn Rt
Assembler syntax
LDR{<c>}{<q>} <Rt>, [<Rn>, <Rm>, LSL #2]
where:
<Rm> Contains the offset that is shifted and applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + LSL(R[m],2);
R[t] = MemU[address,4];
A9-1118 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.4 ThumbEE instructions with modified behavior
Encoding T1 ThumbEE
LDRH<c> <Rt>, [<Rn>, <, <Rm>, LSL #1]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 1 Rm Rn Rt
Assembler syntax
LDRH{<c>}{<q>} <Rt>, [<Rn>, <Rm>, LSL #1]
where:
<Rm> Contains the offset that is shifted and applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + LSL(R[m],1);
R[t] = ZeroExtend(MemU[address,2], 32);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1119
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.4 ThumbEE instructions with modified behavior
Encoding T1 ThumbEE
LDRSH<c> <Rt>, [<Rn>, <Rm>, LSL #1]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 1 Rm Rn Rt
Assembler syntax
LDRSH{<c>}{<q>} <Rt>, [<Rn>, <Rm>, LSL #1]
where:
<Rm> Contains the offset that is shifted and applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + LSL(R[m],1);
R[t] = SignExtend(MemU[address,2], 32);
A9-1120 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.4 ThumbEE instructions with modified behavior
Encoding T1 ThumbEE
STR<c> <Rt>, [<Rn>, <Rm>, LSL #2]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 0 0 Rm Rn Rt
Assembler syntax
STR{<c>}{<q>} <Rt>, [<Rn>, <Rm>, LSL #2]
where:
<Rm> Contains the offset that is shifted and applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + LSL(R[m],2);
MemU[address,4] = R[t];
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1121
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.4 ThumbEE instructions with modified behavior
Encoding T1 ThumbEE
STRH<c> <Rt>, [<Rn>, <Rm>, LSL #1]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 0 1 Rm Rn Rt
Assembler syntax
STRH{<c>}{<q>} <Rt>, [<Rn>, <Rm>, LSL #1]
where:
<Rm> Contains the offset that is shifted and applied to the value of <Rn> to form the address.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = R[n] + LSL(R[m],1);
MemU[address,2] = R[t]<15:0>;
A9-1122 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
These are 16-bit instructions. They occupy the instruction encoding space that STMIA and LDMIA occupy in Thumb
state.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1123
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
A9.5.1 CHKA
CHKA (Check Array) compares the unsigned values in two registers. If the first is lower than, or the same as, the
second, it copies the PC to the LR, and causes a branch to the IndexCheck handler.
Encoding E1 ThumbEE
CHKA<c> <Rn>, <Rm>
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 1 0 1 0 N Rm Rn
n = UInt(N:Rn); m = UInt(Rm);
if n == 15 || m IN {13,15} then UNPREDICTABLE;
Assembler syntax
CHKA{<c>}{<q>} <Rn>, <Rm>
where:
<Rn> The first operand register. This contains the array size. Use of the SP is permitted.
<Rm> The second operand register. This contains the array index.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if UInt(R[n]) <= UInt(R[m]) then
LR = PC<31:1> : '1'; // PC holds this instruction's address + 4
ITSTATE.IT = '00000000';
BranchWritePC(TEEHBR - 8);
Usage
Use CHKA to check that an array index is in bounds.
A9-1124 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
Handler Branch with Link saves a return address to the LR, and then branches to a specified handler.
Encoding E1 ThumbEE
HB{L}<c> #<HandlerID> Outside or last in IT block
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 0 0 1 L handler
Assembler syntax
HB{<c>}{<q>} #<HandlerID> Encoded as L = 0
HBL{<c>}{<q>} #<HandlerID> Encoded as L = 1
where:
<HandlerID> The index number of the handler to be called, in the range 0-255.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
if generate_link then
next_instr_addr = PC - 2;
LR = next_instr_addr<31:1> : '1';
BranchWritePC(TEEHBR + handler_offset);
Exceptions
None.
Usage
HB{L} makes a large number of handlers available.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1125
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
A9.5.3 HBLP
HBLP (Handler Branch with Link and Parameter) saves a return address to the LR, and then branches to a specified
handler. It passes a 5-bit parameter to the handler in R8.
Encoding E1 ThumbEE
HBLP<c> #<imm>, #<HandlerID> Outside or last in IT block
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 0 1 imm5 handler
Assembler syntax
HBLP{<c>}{<q>} #<imm>, #<HandlerID>
where:
<HandlerID> The index number of the handler to be called, in the range 0-31.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
R[8] = imm32;
next_instr_addr = PC - 2;
LR = next_instr_addr<31:1> : '1';
BranchWritePC(TEEHBR + handler_offset);
Exceptions
None.
A9-1126 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
A9.5.4 HBP
HBP (Handler Branch with Parameter) causes a branch to a specified handler. It passes a 3-bit parameter to the
handler in R8.
Encoding E1 ThumbEE
HBP<c> #<imm>, #<HandlerID> Outside or last in IT block
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 0 0 0 0 imm3 handler
Assembler syntax
HBP{<c>}{<q>} #<imm>, #<HandlerID>
where:
<HandlerID> The index number of the handler to be called, in the range 0-31.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
R[8] = imm32;
BranchWritePC(TEEHBR + handler_offset);
Exceptions
None.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1127
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
Encoding E1 ThumbEE
LDR<c> <Rt>, [R9{, #<imm>}]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 1 1 0 imm6 Rt
Encoding E2 ThumbEE
LDR<c> <Rt>, [R10{, #<imm>}]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 1 0 1 1 imm5 Rt
Encoding E3 ThumbEE
LDR<c> <Rt>, [<Rn>{, #-<imm>}]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 1 0 0 imm3 Rn Rt
A9-1128 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
Assembler syntax
LDR{<c>}{<q>} <Rt>, [<Rn>{, #<imm>}]
where:
<imm> The immediate offset used for forming the address. Values are multiples of 4 in the range:
0-252 encoding E1
0-124 encoding E2
–28-0 encoding E3.
<imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(n);
address = if add then (R[n] + imm32) else (R[n] - imm32);
R[t] = MemU[address,4];
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. A9-1129
ID040418 Non-Confidential
A9 The ThumbEE Instruction Set
A9.5 Additional ThumbEE instructions
Encoding E1 ThumbEE
STR<c> <Rt>, [R9, #<imm>]
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 0 1 1 1 imm6 Rt
Assembler syntax
STR{<c>}{<q>} <Rt>, [R9, #<imm>]
where:
<imm> The immediate offset applied to the value of R9 to form the address. Values are multiples of 4 in the
range 0-252.
<imm> can be omitted, meaning an offset of 0.
Operation
if ConditionPassed() then
EncodingSpecificOperations(); NullCheckIfThumbEE(9);
address = R[9] + imm32;
MemU[address,4] = R[t];
A9-1130 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Part B
System Level Architecture
Chapter B1
System Level Programmers’ Model
This chapter provides a system level view of the programmers’ model. It contains the following sections:
• About the System level programmers’ model on page B1-1134
• System level concepts and terminology on page B1-1135
• ARM processor modes and ARM core registers on page B1-1139
• Instruction set states on page B1-1155
• The Security Extensions on page B1-1156
• The Large Physical Address Extension on page B1-1159
• The Virtualization Extensions on page B1-1161
• Exception handling on page B1-1164
• Exception descriptions on page B1-1204
• Coprocessors and system control on page B1-1225
• Advanced SIMD and floating-point support on page B1-1228
• Thumb Execution Environment on page B1-1239
• Jazelle direct bytecode execution on page B1-1240
• Traps to the hypervisor on page B1-1246.
Note
In this chapter, system register names usually link to the description of the register in Chapter B4 System Control
Registers in a VMSA implementation, for example SCTLR. If the register is included in a PMSA implementation,
then it is also described in Chapter B6 System Control Registers in a PMSA implementation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1133
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.1 About the System level programmers’ model
The system level programmers’ model includes all of the system features required to support operating systems and
to handle hardware events.
System level concepts and terminology on page B1-1135 gives a system level introduction to the basic concepts of
the ARM architecture, and the terminology used for describing the architecture. The rest of this chapter describes
the system level programmers’ model.
• The CPUID mechanism, that an OS can use to determine the capabilities of the processor it is running on.
See Chapter B7 The CPUID Identification Scheme.
• The instructions that provide system level functionality, such as returning from an exception. See Chapter B9
System Instructions.
B1-1134 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.2 System level concepts and terminology
The Virtualization Extensions, described in The Virtualization Extensions on page B1-1161, significantly affect
some areas of ARM terminology. For consistency, this manual applies these changes across all ARMv7
implementations.
Mode
The ARM architecture A and R profiles provide a set of modes that support normal software execution and handle
exceptions. The current mode determines:
• The set of registers that are available to the processor.
• The privilege level of the executing software.
For more information, see ARM processor modes and ARM core registers on page B1-1139.
State
In the ARM architecture, state describes the following distinct concepts:
Execution state
The execution state consists of the instruction set state and some control bits that modify how the
instruction stream is decoded. For details, see Execution state registers on page A2-50 and Program
Status Registers (PSRs) on page B1-1147.
Security state In the ARM architecture, the number of security states depends on whether an implementation
includes the Security Extensions:
• An implementation that includes the Security Extensions provides two security states, Secure
state and Non-secure state. Each security state has its own system registers and memory
address space.
The security state is largely independent of the processor mode. The only exceptions to this
independence of security state and processor mode are:
— Monitor mode, that exists only in the Secure state, and supports transitions between
Secure and Non-secure state.
— Hyp mode, part of the Virtualization Extensions, that exits only in the Non-secure
state, because the Virtualization Extensions only support virtualization of the
Non-secure state.
Some system control resources are only accessible from the Secure state.
For more information, see The Security Extensions on page B1-1156.
• An implementation that does not include the Security Extensions provides only a single
security state.
In this manual:
• Secure software means software running in Secure state.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1135
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.2 System level concepts and terminology
Debug state Debug state refers to the processor being halted for debug purposes, because a debug event has
occurred when the processor is configured to Halting debug-mode. See Invasive debug on
page C1-2009.
When the processor is not in Debug state it is described as being in Non-debug state.
Except where explicitly stated otherwise, parts A and B of this manual describe processor behavior
and instruction execution in Non-debug state. Chapter C5 Debug State describes the differences in
Debug state.
Privilege level
Privilege level is an attribute of software execution, in a particular security state, determined by the processor mode,
as follows:
Non-secure state
In Non-secure state there are two or three privilege levels:
PL0 Software executed in User mode executes at PL0.
PL1 Software executed in any mode other than User or Hyp mode executes at PL1.
PL2 In an implementation that includes the Virtualization Extensions, software executed in
Hyp mode executes at PL2.
Software execution at PL0 is sometimes described as unprivileged execution. A mode associated with a particular
privilege level, PLn, can be described as a PLn mode.
Note
• The privilege level defines the ability to access resources in the current security state, and does not imply
anything about the ability to access resources in the other security state.
• An implementation that does not include the Virtualization Extensions has no Non-secure resources that can
be accessed only from the PL2 privilege level.
For more information see Processor privilege levels, execution privilege, and access privilege on page A3-139.
B1.2.2 Exceptions
An exception is a condition that changes the normal flow of control in a program. The change of flow switches
execution to an exception handler, and the state of the system at the point where the exception occurred is presented
to the exception handler. A key component of the state presented to the handler is the return address, that indicates
the point in the instruction stream from which the exception was taken.
The ARM architecture provides a number of different exceptions as described in Exception handling on
page B1-1164. The architecture defines the mode each exception is taken to. The Security Extensions and
Virtualization Extensions add configuration settings that can determine the mode to which an exception is taken.
B1-1136 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.2 System level concepts and terminology
— Indirectly, as a result of something in the state of the system. For example, an exception is generated
as a result of an interrupt signaled by a peripheral.
• An exception is taken by a processor at the point where it causes a change to the normal flow of control in
the program.
The mode in use immediately before an exception is taken is described as the mode the exception is taken
from. The mode that is used on taking the exception is described as the mode the exception is taken to.
The mode an exception is taken to is determined by:
— The type of exception.
— The mode the exception is taken from.
— Configuration settings in the Security Extensions and Virtualization Extensions.
The architecture defines the mode to which each exception is taken in an implementation that does not
include the Security Extensions. This is called the default mode for that exception.This default mode is
unchanged in an implementation that includes the Security Extensions, however in some circumstances
controls provided by the Security Extensions, or by the Virtualization Extensions, might mean that an
exception is not taken to the default mode for that exception, see Processor mode for taking exceptions on
page B1-1172.
Note
For a synchronous exception, the exception is taken from the mode in which it was generated. However, for an
asynchronous exception, the processor mode might change after the exception is generated and before it is taken.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1137
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.2 System level concepts and terminology
In an implementation that does not include the Security Extensions, this requirement applies to the single
security state of the processor.
One effect of these requirements is that an exception taken from Non-secure Hyp mode must be taken to either:
• Non-secure Hyp mode
• Secure Monitor mode.
B1-1138 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
• The Processor mode column gives the name of each mode and the abbreviation used, for example, in the
ARM core register name suffixes used in ARM core registers on page B1-1143.
• The Privilege level column gives the privilege level of software executing in that mode, see Privilege level
on page B1-1136.
• The Security state column applies only to processors that implement the Security Extensions.
Mode changes can be made under software control, or can be caused by an external or internal exception.
System mode Software executing in System mode executes at PL1. System mode has the same registers available
as User mode, and is not entered by any exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1139
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
Supervisor mode
Supervisor mode is the default mode to which a Supervisor Call exception is taken.
Executing a SVC (Supervisor Call) instruction generates an Supervisor Call exception, that is taken
to Supervisor mode.
A processor enters Supervisor mode on Reset.
Abort mode Abort mode is the default mode to which a Data Abort exception or Prefetch Abort exception is
taken.
Undefined mode
Undefined mode is the default mode to which an instruction-related exception, including any
attempt to execute an UNDEFINED instruction, is taken.
FIQ mode FIQ mode is the default mode to which an FIQ interrupt is taken.
IRQ mode IRQ mode is the default mode to which an IRQ interrupt is taken.
Hyp mode Hyp mode is the Non-secure PL2 mode, implemented as part of the Virtualization Extensions. Hyp
mode is entered on taking an exception from Non-secure state that must be taken to PL2
The Hypervisor Call exception and Hyp Trap exception are exceptions that are implemented as part
of the Virtualization Extensions, and that are always taken in Hyp mode.
Note
This means that Hypervisor Call exceptions and Hyp Trap exceptions cannot be taken from Secure
state.
In a Non-secure PL1 mode, executing a HVC (Hypervisor Call) instruction generates a Hypervisor
Call exception.
For more information, see Hyp mode on page B1-1141.
Monitor mode
Monitor mode is the mode to which a Secure Monitor Call exception is taken.
In a PL1 mode, executing an SMC (Secure Monitor Call) instruction generates a Secure Monitor Call
exception.
Monitor mode is a Secure mode, meaning it is always in the Secure state, regardless of the value of
the SCR.NS bit.
Software running in Monitor mode has access to both the Secure and Non-secure copies of system
registers. This means Monitor mode provides the normal method of changing between the Secure
and Non-secure security states.
Note
It is important to distinguish between:
Monitor mode
This is a processor mode that is only available when an implementation includes the
Security Extensions. It is used in normal operation, as a mechanism to transfer between
Secure and Non-secure state, as described in this section.
Monitor debug-mode
This is a debug mode and is available regardless of whether the implementation includes
the Security Extensions. For more information, see About the ARM Debug architecture
on page C1-2009.
Monitor mode is implemented only as part of the Security Extensions. For more information, see
The Security Extensions on page B1-1156.
B1-1140 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
Note
As indicated in the appropriate Mode descriptions:
• Monitor mode is a Secure mode, meaning it is always in the Secure state
• Hyp mode is a Non-secure mode, meaning it is accessible only in Non-secure state.
Figure B1-1 shows the modes, privilege levels, and security states, for an implementation that includes the Security
Extensions and the Virtualization Extensions.
Non-secure PL2
Hyp mode
Hyp mode
Hyp mode is a Non-secure mode, implemented only as part of the Virtualization Extensions. It provides the usual
method of controlling almost all of the functionality of the Virtualization Extensions.
Note
The alternative method of controlling this functionality is by accessing the Hyp mode controls from Secure Monitor
mode, with the SCR.NS bit set to 1.
This section summarizes how Hyp mode differs from the other modes, and references where the features of Hyp
mode are described in more detail:
• Software executing in Hyp mode executes at PL2, see Mode, state, and privilege level on page B1-1135.
• Hyp mode is accessible only in Non-secure state. When the processor is in Secure state, setting CPSR.M to
0b11010, the encoding for Hyp mode, has no meaning. Therefore, in Secure state, the effect of attempting to
set CPSR.M to 0b11010 is UNPREDICTABLE. For more information see The Current Program Status Register
(CPSR) on page B1-1147.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1141
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
• In Non-debug state, the only mechanisms for changing to Hyp mode are:
— An exception taken from a Non-secure PL1 or PL0 mode.
— An exception return from Secure Monitor mode.
• In Hyp mode, the only exception return is execution of an ERET instruction, see ERET on page B9-1968.
• In Hyp mode, the CPACR has no effect on the execution of coprocessor, floating-point, or Advanced SIMD
instructions. The HCPTR controls execution of these instructions in Hyp mode.
• If software running in Hyp mode executes an SVC instruction, the Supervisor Call exception generated by the
instruction is taken to Hyp mode, see SVC (previously SWI) on page A8-721.
• The effect of an exception return with the restored CPSR specifying Hyp mode is UNPREDICTABLE if either:
— SCR.NS is set to 0.
— The return is from a Non-secure PL1 mode.
• The instructions described in the following sections are UNDEFINED if executed in Hyp mode:
— SRS (Thumb) on page B9-1990.
— SRS (ARM) on page B9-1992.
— RFE on page B9-1986.
— LDM (exception return) on page B9-1972.
— LDM (User registers) on page B9-1974.
— STM (User registers) on page B9-1994.
— SUBS PC, LR and related instructions (ARM) on page B9-1998.
— SUBS PC, LR (Thumb) on page B9-1996, when executed with a nonzero constant.
Note
In Thumb state, ERET is encoded as SUBS PC, LR, #0, and therefore this is a valid instruction.
• The unprivileged Load unprivileged and Store unprivileged instructions LDRT, LDRSHT, LDRHT, LDRBT, STRT,
STRHT, and STRBT, are UNPREDICTABLE if executed in Hyp mode.
From reset, the HVC instruction is UNDEFINED in Non-secure PL1 modes, meaning entry to Hyp mode is disabled by
default. To permit entry to Hyp mode using the Hypervisor Call exception, Secure software must enable use of the
HVC instruction by setting the SCR.HCE bit to 1. In addition, when SCR.HCE is set to 0, HVC is UNPREDICTABLE in
Hyp mode.
// BadMode()
// =========
The following pseudocode functions provide information about the current mode:
// CurrentModeIsNotUser()
B1-1142 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
// ======================
boolean CurrentModeIsNotUser()
if BadMode(CPSR.M) then UNPREDICTABLE;
if CPSR.M == '10000' then return FALSE; // User mode
return TRUE; // Other modes
// CurrentModeIsUserOrSystem()
// ===========================
boolean CurrentModeIsUserOrSystem()
if BadMode(CPSR.M) then UNPREDICTABLE;
if CPSR.M == '10000' then return TRUE; // User mode
if CPSR.M == '11111' then return TRUE; // System mode
return FALSE; // Other modes
// CurrentModeIsHyp()
// ==================
boolean CurrentModeIsHyp()
if BadMode(CPSR.M) then UNPREDICTABLE;
if CPSR.M == '11010' then return TRUE; // Hyp mode
return FALSE; // Other modes
Note
• The architecture uses system level register names, such as R0_usr, R8_usr, and R8_fiq, when it must identify
a specific register. The application level names refer to the registers for the current mode, and usually are
sufficient to identify a register.
• The Security Extensions and Virtualization Extensions are supported only in the ARMv7-A architecture
profile.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1143
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
Application
level view System level view
APSR CPSR
SPSR_hyp SPSR_svc SPSR_abt SPSR_und SPSR_mon SPSR_irq SPSR_fiq
ELR_hyp
‡ Part of the Security Extensions. Exists only in Secure state.
† Part of the Virtualization Extensions. Exists only in Non-secure state.
Cells with no entry indicate that the User mode register is used.
Figure B1-2 ARM core registers, PSRs, and ELR_hyp, showing register banking
As described in Processor mode for taking exceptions on page B1-1172, on taking an exception the processor
changes mode, unless it is already in the mode to which it must take the exception. Each mode that the processor
might enter in this way has:
• A Banked copy of the stack pointer, for example SP_irq and SP_hyp.
• A register that holds a preferred return address for the exception. This is:
— For each PL1 mode, a Banked copy of the link register, for example LR_und and LR_mon.
— For the PL2 mode, Hyp mode, the special register ELR_hyp.
• A saved copy of the CPSR, made on exception entry, for example SPSR_irq and SPSR_hyp.
In addition FIQ mode has Banked copies of the ARM core registers R8 to R12.
User mode and System mode share the same ARM core registers.
User mode, System mode, and Hyp mode share the same LR.
For more information about the application level view of the SP, LR, and PC, and the alternative descriptions of
them as R13, R14 and R15, see ARM core registers on page A2-45.
B1-1144 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
// RBankSelect()
// =============
// RfiqBankSelect()
// ================
// LookUpRName()
// =============
// In Non-secure state, check for attempted use of Monitor mode ('10110'), or of FIQ
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1145
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
// mode ('10001') when the Security Extensions are reserving the FIQ registers. The
// definition of UNPREDICTABLE does not permit this to be a security hole.
if !IsSecure() && mode == '10110' then UNPREDICTABLE;
if !IsSecure() && mode == '10001' && NSACR.RFR == '1' then UNPREDICTABLE;
return _R[LookUpRName(n,mode)];
// In Non-secure state, check for attempted use of Monitor mode ('10110'), or of FIQ
// mode ('10001') when the Security Extensions are reserving the FIQ registers. The
// definition of UNPREDICTABLE does not permit this to be a security hole.
if !IsSecure() && mode == '10110' then UNPREDICTABLE;
if !IsSecure() && mode == '10001' && NSACR.RFR == '1' then UNPREDICTABLE;
_R[LookUpRName(n,mode)] = value;
return;
bits(32) R[integer n]
assert n >= 0 && n <= 15;
if n == 15 then
offset = if CurrentInstrSet() == InstrSet_ARM then 8 else 4;
result = _R[RName_PC] + offset;
else
result = Rmode[n, CPSR.M];
return result;
// SP - non-assignment form
// ========================
bits(32) SP
return R[13];
// SP - assignment form
// ====================
SP = bits(32) value
R[13] = value;
// LR - non-assignment form
// ========================
bits(32) LR
return R[14];
// LR - assignment form
// ====================
LR = bits(32) value
R[14] = value;
// PC - non-assignment form
// ========================
bits(32) PC
B1-1146 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
return R[15];
// BranchTo()
// ==========
BranchTo(bits(32) address)
_R[RName_PC] = address;
return;
Every mode that an exception can be taken to has its own saved copy of the CPSR, the Saved Program Status
Register (SPSR), as shown in Figure B1-2 on page B1-1144. For example, the SPSR for Monitor mode is called
SPSR_mon.
The non-APSR bits of the CPSR have defined reset values. These are shown in the TakeReset() pseudocode
function, see Reset on page B1-1204.
Writes to the CPSR have side-effects on various aspects of processor operation. All of these side-effects, except for
those on memory accesses associated with fetching instructions, are synchronous to the CPSR write. This means
they are guaranteed:
• Not to be visible to earlier instructions in the execution stream.
• To be visible to later instructions in the execution stream.
The privilege level and address space of memory accesses associated with fetching instructions depend on the
current privilege level and security state. Writes to CPSR.M can change one of both of the privilege level and
security state. The effect, on memory accesses associated with fetching instructions, of a change of privilege level
or security state is:
• Synchronous to the change of privilege level or security state, if that change is caused by an exception entry
or exception return.
• Guaranteed not to be visible to any memory access caused by fetching an earlier instruction in the execution
stream.
• Guaranteed to be visible to any memory access caused by fetching any instruction after the next context
synchronization operation in the execution stream.
Note
See Context synchronization operation for the definition of this term.
• Might or might not affect memory accesses caused by fetching instructions between the mode change
instruction and the point where the mode change is guaranteed to be visible.
See Exception return on page B1-1193 for the definition of exception return instructions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1147
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
• On exception return, restore the CPSR to the value it had immediately before the exception was taken.
• Examine the value that the CPSR had when the exception was taken, for example to determine the instruction
set state and privilege level in which the instruction that caused an Undefined Instruction exception was
executed.
The SPSRs are UNKNOWN on reset. Any operation in a Non-secure PL1 or PL0 mode makes SPSR_hyp UNKNOWN.
Q, bit[27] Cumulative saturation bit. This bit can be read or written in any mode, and is described in The
Application Program Status Register (APSR) on page A2-49.
GE[3:0], bits[19:16]
Greater than or Equal flags, for the parallel addition and subtraction (SIMD) instructions described
in Parallel addition and subtraction instructions on page A4-169.
The GE[3:0] field can be read or written in any mode, and is described in The Application Program
Status Register (APSR) on page A2-49.
E, bit[9] Endianness execution state bit. Controls the load and store endianness for data accesses:
0 Little-endian operation.
1 Big-endian operation.
Instruction fetches ignore this bit.
B1-1148 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
Endianness mapping register, ENDIANSTATE on page A2-53 describes the encoding of this bit.
CPSR.E is the ENDIANSTATE bit described there.
For details of how this bit can be accessed see Accessing the execution state bits on page B1-1150.
When the reset value of the SCTLR.EE bit is defined by a configuration input signal, that value also
applies to the CPSR.E bit on reset, and therefore applies to software execution from reset.
T, bit[5] Thumb execution state bit. This bit and the J execution state bit, bit[24], determine the instruction
set state of the processor, ARM, Thumb, Jazelle, or ThumbEE. Instruction set state register,
ISETSTATE on page A2-50 describes the encoding of these bits. CPSR.J and CPSR.T are the same
bits as ISETSTATE.J and ISETSTATE.T respectively. For more information, see Instruction set
states on page B1-1155.
For details of how these bits can be accessed see Accessing the execution state bits on page B1-1150.
M[4:0], bits[4:0]
Mode field. This field determines the current mode of the processor. The permitted values of this
field are listed in Table B1-1 on page B1-1139. All other values of M[4:0] are reserved. The effect
of setting M[4:0] to a reserved value is UNPREDICTABLE.
Note
See the entry for UNPREDICTABLE in the Glossary for the restrictions on UNPREDICTABLE
behavior. These restrictions mean that, for any CPSR.M value that is defined as UNPREDICTABLE in
Non-secure state, the UNPREDICTABLE behavior must not cause entry to Secure state, or to any mode
that the current configuration settings mean is not accessible in Non-secure state.
For more information about the processor modes see ARM processor modes on page B1-1139.
Figure B1-2 on page B1-1144 shows the registers that can be accessed in each mode.
In a Non-debug state, this field can be written only at PL1 or higher. Its value can be read in any
mode, but ARM deprecates software executing at PL0 making any use of its value, or attempting to
change it.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1149
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
In an implementation that includes the Security Extensions, except as a result of an exception entry
or exception return:
• Attempting to change CPSR.M to enter Monitor mode from Non-secure state is
UNPREDICTABLE.
• When NSACR.RFR is set to 1, attempting to change CPSR.M to enter FIQ mode from
Non-secure state is UNPREDICTABLE.
From the introduction of the Virtualization Extensions, ARM deprecates any use of
NSACR.RFR.
In an implementation that includes the Virtualization Extensions, except as a result of an exception
entry or exception return:
• Attempting to change CPSR.M to enter Hyp mode from any mode other than Hyp mode is
UNPREDICTABLE.
• Attempting to change CPSR.M to enter any mode other than Hyp mode from Hyp mode is
UNPREDICTABLE.
For more information about the behavior of this field in Debug state, see Behavior of MRS and MSR
instructions that access the CPSR in Debug state on page C5-2085.
Unlike the other execution state bits in the CPSR, at PL1 or above CPSR.E can be read by an MRS instruction and
written by an MSR instruction. However, ARM deprecates:
• Using the CPSR.E value read by an MRS instruction.
• Using an MSR instruction to change the value of CPSR.E.
At PL0, a read of the CPSR by an MSR instruction returns an UNKNOWN value for the E bit, and a write by an MSR
instruction has no effect on the E bit.
Note
• Software can use the SETEND instruction to change the current endianness.
• To determine the current endianness, software can use an LDR instruction to load a word of memory with a
known value that differs if the endianness is reversed. For example, using an LDR (literal) instruction to load
a word whose four bytes are 0x01, 0x00, 0x00, and 0x00 in ascending order of memory address loads the
destination register with:
— 0x00000001 if the current endianness is little-endian.
— 0x01000000 if the current endianness is big-endian.
For more information about the behavior of these bits in Debug state see Behavior of MRS and MSR instructions
that access the CPSR in Debug state on page C5-2085.
B1-1150 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
Non-maskable FIQs
Some ARMv7 implementations can be configured so that the CPSR.F bit cannot be set to 1 by an MSR or CPS
instruction. This is defined as Non-maskable FIQ (NMFI) operation. In such an implementation, this configuration
is controlled by a configuration input signal, that is asserted HIGH to enable NMFI operation.
Note
There is no software control of NMFI operation.
The Virtualization Extensions do not support NMFIs. Otherwise, it is IMPLEMENTATION DEFINED whether an
ARMv7 processor supports NMFIs. In all cases, software can detect whether FIQs are maskable by reading the
SCTLR.NMFI bit:
NMFI == 0 Software can mask FIQs by setting the CPSR.F bit to 1.
NMFI == 1 Software cannot set the CPSR.F bit to 1. This means software cannot mask FIQs.
• An instruction writing 0 to the CPSR.F bit clears it to 0, but an instruction attempting to write 1 to it leaves
it unchanged.
• CPSR.F can be set to 1 only by exception entries, as described in CPSR.{A, I, F, M} values on exception entry
on page B1-1181.
In an implementation that includes the Security Extensions, this restriction on accessing CPSR.F interacts with the
SCR.FW control, as described in Effects of the Security Extensions on the CPSR A and F bits.
Note
For an implementation that includes the Security Extensions but not the Virtualization Extensions, when the
processor is in the Non-secure state, software executing at PL1 can change the SPSR.F and SPSR.A bits even if the
corresponding bits in the SCR are set to 0. However, when the SPSR is copied to the CPSR the CPSR.F and CPSR.A
bits are not updated if the corresponding bits in the SCR are set to 0.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1151
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
For an implementation that includes the Security Extensions but not the Virtualization Extensions, Table B1-2
shows how, in Non-secure state, SCR.FW interacts with SCTLR.NMFI to control possible updates to CPSR.F bit.
The table includes the SCTLR.NMFI controls in Secure state.
Table B1-2 NMFI behavior, Security Extensions implemented without the Virtualization Extensions
Note
The SCTLR.NMFI bit is common to the Secure and Non-secure versions of the SCTLR, because it is a read-only
bit that reflects the value of a configuration input signal.
The Virtualization Extensions do not support NMFIs. In an implementation that includes the Virtualization
Extensions, SCTLR.NMFI is RAZ.
bits(32) SPSR[]
if BadMode(CPSR.M) then
UNPREDICTABLE;
else
bits(32) result;
case CPSR.M of
when '10001' result = SPSR_fiq; // FIQ mode
when '10010' result = SPSR_irq; // IRQ mode
when '10011' result = SPSR_svc; // Supervisor mode
when '10110' result = SPSR_mon; // Monitor mode
when '10111' result = SPSR_abt; // Abort mode
when '11010' result = SPSR_hyp; // Hyp mode
when '11011' result = SPSR_und; // Undefined mode
otherwise UNPREDICTABLE;
return result;
B1-1152 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
// CPSRWriteByInstr()
// ==================
return;
// SPSRWriteByInstr()
// ==================
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1153
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.3 ARM processor modes and ARM core registers
return;
B1.3.4 ELR_hyp
Hyp mode does not provide its own Banked copy of LR. Instead, on taking an exception to Hyp mode, the preferred
return address is stored in ELR_hyp, a 32-bit Special register implemented for this purpose.
The ERET instruction uses the value in ELR_hyp as the return address for the exception. For more information, see
ERET on page B9-1968.
Software execution in any Non-secure PL1 or PL0 mode makes ELR_hyp UNKNOWN.
For more information about the use of ELR_hyp see Exceptions on page B1-1136.
B1-1154 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.4 Instruction set states
If the exception is taken to Hyp mode, the HSCTLR.TE bit determines the processor instruction set state that
handles the exception, and if necessary, the processor changes to this instruction set state on exception entry.
On coming out of reset, the processor starts execution in Supervisor mode, in the instruction set state determined by
the reset value of SCTLR.TE.
For more information see:
• For a VMSA implementation:
— SCTLR, System Control Register, VMSA on page B4-1700.
— HSCTLR, Hyp System Control Register, Virtualization Extensions on page B4-1587.
• For a PMSA implementation, SCTLR, System Control Register, PMSA on page B6-1921.
For more information about exception entry see Overview of exception entry on page B1-1169.
• The ThumbEE state is optional in the ARMv7-R architecture. ARM does not recommend support for
ThumbEE state in any ARMv7-R implementation.
Some system instructions permit setting CPSR.{J, T} to values that select an unimplemented instruction set state,
for example setting CPSR.J to 1 and CPSR.T to 0 on an processor that does not implement the Jazelle state. If such
values are written to CPSR.{J, T}, the implementation behaves in one of these ways:
• Sets CPSR.{J, T} to the requested values and causes the next instruction to generate an Undefined Instruction
exception, as described in Exception return to an unimplemented instruction set state on page B1-1196.
• Does not set CPSR.{J, T} to the requested values. The processor might change the value of one or both of
the bits in such a way that the new values correspond to an implemented instruction set state. If this is done
then the instruction set state changes to this new state. The detailed behavior of the attempt to change to an
unimplemented state is IMPLEMENTATION DEFINED.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1155
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.5 The Security Extensions
Note
The Security Extensions are also permitted as an extension to the ARMv6K architecture. The resulting combination
is sometimes called the ARMv6Z or ARMv6KZ architecture.
The following sections give general information about the Security Extensions:
• Security states.
• Impact of the Security Extensions on the modes and exception model on page B1-1157.
• Security Extensions features added by the Virtualization Extensions on page B1-1158.
• Classification of system control registers on page B3-1447.
• Each security state operates in its own virtual memory address space, with its own translation regime.
Note
Figure B3-1 on page B3-1307 shows the different translation regimes.
• Many system controls can be set independently in each of the security states.
• All of the processor modes that are available in a system that does not implement the Security Extensions are
available in each of the security states. However:
— In any implementation that includes the Security Extensions, Monitor mode is available only in Secure
state.
— In an implementation that also includes the Virtualization Extensions, Hyp mode is available only in
Non-secure state.
The Security Extensions also define an additional processor mode, Monitor mode, that provides a bridge between
software running in Non-secure state and software running in Secure state, see Changing from Secure to Non-secure
state on page B1-1157.
The following features mean the two security states can provide more security than is typically provided by systems
using the split between the different levels of execution privilege:
• The memory system provides mechanisms that prevent the Non-secure state accessing regions of the physical
memory designated as Secure.
• System controls that apply to the Secure state are not accessible from the Non-secure state.
• Entry to the Secure state from the Non-secure state is provided only by a small number of exceptions.
• Exit from the Secure state to the Non-secure state is provided only by a small number of mechanisms.
• Many operating system and hypervisor exceptions can be handled without changing security state.
The fundamental mechanism that determines the security state is the SCR.NS bit:
• For all modes other than Monitor mode and Hyp mode, the SCR.NS bit determines the security state for
software execution.
B1-1156 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.5 The Security Extensions
• In an implementation that includes the Virtualization Extensions, Hyp mode is available only in Non-secure
state, meaning it is available only when the SCR.NS bit is set to 1.
• Software executing in Monitor mode executes in the Secure state regardless of the value of the SCR.NS bit.
The ARM core registers and the processor status registers are not Banked between the Secure and the Non-secure
states. ARM expects that, when switching execution between the Non-secure and Secure states, a kernel running
mostly in Monitor mode will switch the values of these registers.
The registers LR_mon and SPSR_mon are UNKNOWN when executing in Non-secure state.
Many of the system registers referred to in Coprocessors and system control on page B1-1225 are Banked between
the Secure and Non-secure security states. A Banked copy of a register applies only to execution in the appropriate
security state. A small number of system registers are not Banked but apply to both the Secure and Non-secure
security states. The registers that are not Banked relate to global system configuration options that ARM expects to
be common to the two security states.
Note
When the value of NSACR.RFR is 1, if the processor is in Secure FIQ mode, the effect of changing SCR.NS
to 1 is UNPREDICTABLE.
• The usual mechanism for changing from Secure to Non-secure state is an exception return.To return to
Non-secure state, software executing in Monitor mode sets SCR.NS to 1 and then performs the exception
return.
The IsSecure() function returns TRUE if the processor is in Secure state, or if the implementation does not include
the Security Extensions, and FALSE otherwise.
// IsSecure()
// ==========
boolean IsSecure()
return !HaveSecurityExt() || SCR.NS == '0' || CPSR.M == '10110'; // Monitor mode
B1.5.2 Impact of the Security Extensions on the modes and exception model
This section gives an overview of the effect of the Security Extensions on the modes and exception model:
• Monitor mode is implemented only as part of the Security Extensions. For more information, see ARM
processor modes on page B1-1139 and Security states on page B1-1156.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1157
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.5 The Security Extensions
• The Secure Monitor Call (SMC) exception is implemented only as part of the Security Extensions. The SMC
instruction generates this exception. For more information, see Secure Monitor Call (SMC) exception on
page B1-1210 and SMC (previously SMI) on page B9-1988.
• For exceptions taken to any PL1 mode, because the SCTLR is Banked between the Secure and Non-secure
states, the V and VE bits are defined independently for the Secure and Non-secure states. For each state:
— The SCTLR.V bit controls whether the low or the high exception vectors are used.
— For the IRQ and FIQ exceptions, the SCTLR.VE bit controls whether the IRQ and FIQ vectors are
IMPLEMENTATION DEFINED.
For more information, see Exception vectors and the exception base address on page B1-1164.
• For exceptions taken to any PL1 mode, the base address for the low exception vectors is held in a register
that is Banked between the two security states, meaning this base address is defined independently for each
security state.
Another register holds the base address for exceptions taken to Monitor mode.
For more information, see Exception vectors and the exception base address on page B1-1164.
• Setting bits in the SCR to 1 causes one or more of external aborts, IRQs and FIQs to be taken to Monitor
mode and to use the Monitor exception base address, see Asynchronous exception routing controls on
page B1-1174.
• When an exception is taken from Monitor mode in Non-debug state, SCR.NS is set to zero, to ensure that the
exception is taken to Secure state. However, if an exception is taken from Monitor mode in Debug state, the
exception entry does not change the value of SCR.NS.
Note
Many uses of the Security Extensions can be simplified if the system is designed so that exceptions cannot
be taken from Monitor mode.
• Clearing bits in the SCR to 0 prevents software executing in Non-secure state from being able to mask one
or both of asynchronous aborts and FIQs. The mechanism to do this depends on whether the implementation
includes the Virtualization Extensions, see Asynchronous exception masking on page B1-1183. With either
mechanism:
— Clearing the SCR.AW bit to 0 prevents Non-secure masking of asynchronous aborts that are taken to
Monitor mode.
— Clearing the SCR.FW bit to 0 prevents Non-secure masking of FIQs that are taken to Monitor mode.
• When the SCR.SIF bit is set to 1, any instruction fetched from Non-secure physical memory cannot be
executed in Secure state. For more information, see Restriction on Secure instruction fetch on page B3-1357.
• SCTLR and HSCTLR include WXN bits that, when set to 1, prevent instruction execution from writable
memory regions.
Similarly, setting SCTLR.UWXN to 1 prevents instruction execution from any memory region that
unprivileged software can write to.
For more information see Preventing execution from writable locations on page B3-1357.
• When the SCR.SCD bit is set to 1, entry to Secure state by taking a Secure Monitor Call exception is disabled.
This means that, when SCR.SCD is set to 1:
— An SMC instruction executed in Non-secure state, and not trapped by the HCR.TSC mechanism
described in Trapping use of the SMC instruction on page B1-1253, is UNDEFINED.
— An SMC instruction executed in a Secure PL1 mode is UNPREDICTABLE.
For more information, see SMC (previously SMI) on page B9-1988.
B1-1158 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.6 The Large Physical Address Extension
The Large Physical Address Extension adds a new translation table format:
• The format used in an implementation that does not include the Large Physical Address Extension is now
called the Short-descriptor format, see Short-descriptor translation table format on page B3-1321.
• The format added by the Large Physical Address Extension is the Long-descriptor format, see
Long-descriptor translation table format on page B3-1334.
An implementation that includes the Large Physical Address Extension must support both translation table formats.
Other effects of the Large Physical Address Extension are described throughout this manual, and include:
• Changes to the permitted attributes for Device memory regions, see Summary of ARMv7 memory attributes
on page A3-124 and Device and Strongly-ordered memory shareability, Large Physical Address Extension
on page A3-135.
Note
The ordering requirements for Device accesses are identical to those for Strongly-ordered accesses, see
Ordering requirements for memory accesses on page A3-146.
• The addition of a requirement that LDRD and STRD accesses to 64-bit aligned locations are 64-bit single-copy
atomic as seen by translation table walks and accesses to translation tables, see Single-copy atomicity on
page A3-125.
• Requiring the Short-descriptor translation table format to include the Privileged execute-never (PXN)
attribute, see Memory attributes in the Short-descriptor translation table format descriptors on
page B3-1325.
Note
— In an implementation that does not include the Large Physical Address Extension, the inclusion of the
PXN attribute in the Short-descriptor translation table format is OPTIONAL.
— The Long-descriptor translation table format always includes the PXN attribute.
• An implementation that includes the Large Physical Address Extension must implement the Multiprocessing
Extensions and therefore cannot include the FCSE, see Use of the Fast Context Switch Extension on
page D9-2463.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1159
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.6 The Large Physical Address Extension
B1-1160 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.7 The Virtualization Extensions
When implemented, the Virtualization Extensions provide a set of hardware features that support virtualizing the
Non-secure state of an ARM VMSAv7 implementation. The basic model of a virtualized system involves:
• A hypervisor, running in Non-secure Hyp mode, that is responsible for switching Guest operating systems.
• A number of Guest operating systems, each of which runs in the Non-secure PL1 and PL0 modes.
• For each Guest operating system, applications, that usually run in User mode.
Note
A Guest OS runs on a virtual machine. However, its own view is that it is running on an ARM processor. Normally,
a Guest OS is completely unaware:
• That it is running on a virtual machine.
• Of any other Guest OS.
• A Guest operating system, including all applications and tasks running under that operating system, runs on
a virtual machine.
Each virtual machine is identified by a virtual machine identifier (VMID), assigned by the hypervisor.
Many features of the architecture are extended to integrate with the Virtualization Extensions, and because of this
integration of the Virtualization Extensions into the architecture, features of the Virtualization Extensions are
described in many sections of this manual. The key features are:
• Hyp mode is implemented only in Non-secure state, to support Guest OS management. Hyp mode operates
in its own Non-secure virtual address space, that is different from the Non-secure virtual address space
accessed from Non-secure PL0 and PL1 modes.
• With the Security Extensions, the Virtualization Extensions control the routing of interrupts and
asynchronous Data Abort exceptions to the appropriate one of:
— The current Guest OS.
— A Guest OS that is not currently running.
— The hypervisor.
— The Secure monitor.
• When an implementation includes the Virtualization Extensions, it provides independent translation regimes
for memory accesses from:
— Secure modes, the Secure PL1&0 translation regime.
— Non-secure Hyp mode, the Non-secure PL2 translation regime.
— Non-secure PL1 and PL0 modes, the Non-secure PL1&0 translation regime.
Figure B3-1 on page B3-1307 shows these translation regimes.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1161
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.7 The Virtualization Extensions
• In the Non-secure PL1&0 translation regime, address translation occurs in two stages:
— Stage 1 maps the Virtual Address (VA) to an Intermediate Physical Address (IPA). Typically, the Guest
OS configures and controls this stage, and believes that the IPA is the Physical Address (PA).
— Stage 2 maps the IPA to the PA. Typically, the hypervisor controls this stage, and a Guest OS is
completely unaware of this translation.
For more information, see About address translation on page B3-1309.
Impact of the Virtualization Extensions on the modes and exception model gives more information about many of
these features.
B1.7.1 Impact of the Virtualization Extensions on the modes and exception model
This section summarizes the effect of the Virtualization Extensions on the modes and exception model. An
implementation that includes the Virtualization Extensions:
• Implements a new Non-secure mode, Hyp mode. Hyp mode on page B1-1141 summarizes how Hyp mode
differs from the other processor modes.
• Implements a new register that holds the exception vector base address for exceptions taken to Hyp mode,
the HVBAR.
• Provides controls that can be used to route IRQs, FIQs, and asynchronous aborts, to Hyp mode. This is
possible only if Secure software has not routed the exception to Monitor mode, and applies only to exceptions
taken from a Non-secure mode.
For more information see Asynchronous exception routing controls on page B1-1174.
• Provides controls that can be used to route some synchronous exceptions, taken from Non-secure modes, to
Hyp mode. For more information see Routing general exceptions to Hyp mode on page B1-1190 and Routing
Debug exceptions to Hyp mode on page B1-1193.
• Provide mechanisms to trap processor functions to Hyp mode, using the Hyp Trap exception, see Traps to
the hypervisor on page B1-1246.
When an operation is trapped to Hyp mode, the hypervisor typically either:
— Emulates the required operation, so the application running in the Guest OS is unaware of the trap to
Hyp mode.
— Returns an error to the Guest OS.
• Implements enhanced exception reporting for exceptions taken to Hyp mode, see Reporting exceptions taken
to the Non-secure PL2 mode on page B3-1417. These exceptions are reported using the HSR, see Use of the
HSR on page B3-1421,
• Implements a new exception return instruction, ERET, for return from Hyp mode. For more information see
Hyp mode on page B1-1141.
B1-1162 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.7 The Virtualization Extensions
• The Virtual FIQ exception, that corresponds to the physical FIQ exception.
• The Virtual Abort exception, that corresponds to a physical asynchronous External Data Abort exception.
Software executing in Hyp mode can use these to signal exceptions to the other Non-secure modes. A Non-secure
PL1 or PL0 mode cannot distinguish a virtual exception from the corresponding physical exception.
A usage model for these exceptions is that physical IRQs, FIQs and asynchronous aborts that occur when the
processor is in a Non-secure PL1 or PL0 mode are routed to Hyp mode. The exception handler, executing in Hyp
mode, determines whether the exception can be handled in Hyp mode or requires routing to a Guest OS. When an
exception requires handling by a Guest OS it is marked as pending for that Guest OS. When the hypervisor switches
to a particular Guest OS, it uses the appropriate virtual exception to signal any pending virtual exception to that
Guest OS.
For more information see Virtual exceptions in the Virtualization Extensions on page B1-1196.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1163
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Normally, when an exception is taken the processor state is preserved immediately, before handling the exception.
This means that, when the event has been handled, the original state can be restored and program execution resumed
from the point where the exception was taken.
More than one exception might be generated at the same time, and a new exception can be generated while the
processor is handling an exception.
A set of exception vectors comprises eight consecutive word-aligned memory addresses, starting at an exception
base address. These eight vectors form a vector table. For the IRQ and FIQ exceptions only, when the exceptions
are taken to IRQ mode and FIQ mode, software can change the exception vectors from the vector table values by
setting the SCTLR.VE bit to 1, see Vectored interrupt support on page B1-1167.
The number of possible exception base addresses, and therefore the number of vector tables, depends on the
implemented architecture profile and extensions, as follows:
Note
ARM deprecates using the Hivecs setting, SCTLR.V == 1, in ARMv7-R. ARM recommends that
Hivecs is used only in ARMv7-A implementations.
B1-1164 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
• The Hyp mode column defines the vector table entries for exceptions taken to Hyp mode.
• The Monitor mode column defines the vector table entries for exceptions taken to Monitor mode.
• The Secure and Non-secure columns define the Secure and Non-secure vector table entries, that are used for
exceptions taken to PL1 modes other than Monitor mode. Table B1-4 on page B1-1166 shows the mode to
which each of these exceptions is taken. Each of these modes is described as the default mode for taking the
corresponding exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1165
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
For more information about determining the mode to which an exception is taken, see Processor mode for taking
exceptions on page B1-1172.
The Virtualization Extensions provide a number of additional exceptions, some of which are not shown explicitly
in the vector tables. For more information, see Offsets of exceptions introduced by the Virtualization Extensions.
Vector tables
Offset
Hyp a Monitor b Secure Non-secure
0x04 Undefined Instruction, from Hyp mode Not used Undefined Instruction Undefined Instruction
0x08 Hypervisor Call, from Hyp mode Secure Monitor Call Supervisor Call Supervisor Call
0x0C Prefetch Abort, from Hyp mode Prefetch Abort Prefetch Abort Prefetch Abort
0x10 Data Abort, from Hyp mode Data Abort Data Abort Data Abort
0x14 Hyp Trap, or Hyp mode entry c Not used Not used Not used
a. Non-secure state only. Implemented only if the implementation includes the Virtualization Extensions.
b. Secure state only. Implemented only if the implementation includes the Security Extensions.
c. See Use of offset 0x14 in the Hyp vector table on page B1-1167.
Table B1-4 Modes for taking exceptions using the Secure or Non-secure vector table
Reset Supervisor
For more information about use of the vector tables see Overview of exception entry on page B1-1169.
The Virtualization Extensions introduce the following new exceptions. The processor enters the handlers for these
exceptions using the following vector table entries shown in Table B1-3:
Hypervisor Call
If taken from Hyp mode, shown explicitly in the Hyp mode vector table. Otherwise, see Use of offset
0x14 in the Hyp vector table on page B1-1167.
Virtual Abort Entered through the Data Abort vector in the Non-secure vector table.
B1-1166 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Virtual IRQ Entered through the IRQ vector in the Non-secure vector table.
Virtual FIQ Entered through the FIQ vector in the Non-secure vector table.
Note
The virtual exceptions on page B1-1162 summarizes these exceptions, and Virtual exceptions in the Virtualization
Extensions on page B1-1196 gives more information.
The vector at offset 0x14 in the Hyp vector table is used for exceptions that cause entry to Hyp mode. This means it
is:
• Used for the following exceptions, when the exception is not taken from Hyp mode:
— Hypervisor Call.
— Supervisor Call, when caused by execution of an SVC instruction in Non-secure User mode when
HCR.TGE is set to 1.
— Undefined Instruction.
— Prefetch Abort.
— Data Abort.
Table B1-3 on page B1-1166 shows the offsets used for these exceptions when they are taken from Hyp
mode.
• Never used for IRQ exceptions, Virtual IRQ exceptions, FIQ exceptions, or Virtual FIQ exceptions.
For more information, see Processor mode for taking exceptions on page B1-1172.
For an exception taken to a PL1 mode other than Monitor mode, the ExcVectorBase() function determines the
exception base address:
// ExcVectorBase()
// ===============
bits(32) ExcVectorBase()
if SCTLR.V == '1' then // Hivecs selected, base = 0xFFFF0000
return Ones(16):Zeros(16);
elsif HaveSecurityExt() then
return VBAR;
else
return Zeros(32);
If an implementation supports vectored interrupts, enabling this feature means an interrupt controller can prioritize
interrupts and provide the address of the required interrupt handler directly to the processor, for use as the interrupt
vector. For interrupts taken to PL1 modes other than Monitor mode, vectored interrupt behavior is enabled by setting
the SCTLR.VE bit to 1, see either:
• SCTLR, System Control Register, VMSA on page B4-1700.
• SCTLR, System Control Register, PMSA on page B6-1921.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1167
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
The hardware that supports vectored interrupts is IMPLEMENTATION DEFINED, and an implementation might not
include any support for this operation.
• The SCTLR.VE bit is Banked between Secure and Non-secure states to provide independent control of
whether vectored interrupt support is enabled.
• Interrupts can be routed to Monitor mode, by setting either or both of the SCR.IRQ and SCR.FIQ bits to 1.
When an interrupt is routed to Monitor mode it uses the vector in the vector table at the Monitor exception
base address held in MVBAR, regardless of the value of either Banked copy of the SCTLR.VE bit.
The Virtualization Extensions do not support this vectoring of the IRQ and FIQ exceptions when these exceptions
are routed to Hyp mode. When an interrupt is routed to Hyp mode, it uses the vector in the vector table at the Hyp
exception base address held in HVBAR, regardless of the value of either Banked copy of the SCTLR.VE bit.
From the introduction of the Virtualization Extensions, ARM deprecates any use of the SCTLR.VE bit.
A Breakpoint debug event, or an address matching form of the Vector catch debug event, is associated with the
instruction. This means the corresponding exception is taken before the instruction is executed. Therefore, when a
Breakpoint or address matching Vector catch debug event occurs, no other synchronous exception or debug event,
that might have occurred as a result of executing the instruction, can occur.
Note
• The Exception trapping form of the Vector catch debug event, introduced in v7.1 Debug, causes a debug
event as a result of trapping an exception that has been prioritized as described in this section. This means it
is outside the scope of the description in this section. For more information see Vector catch debug events on
page C3-2053.
• In v7 Debug, the only supported Vector catch debug events are address matching Vector catch debug events.
Otherwise:
• An instruction that generates an Undefined Instruction exception or a Hyp Trap exception cannot cause any
memory access, and therefore cannot cause a Data Abort exception.
• If an instruction generates both an Undefined Instruction exception and a Hyp Trap exception then, unless
this manual explicitly states otherwise, the Undefined Instruction exception has priority.
• If a system call is configured to generate an Undefined Instruction exception or a Hyp Trap exception, then
the Undefined Instruction exception or the Hyp Trap exception has priority over the system call. The system
calls are the SVC, HVC, and SMC instructions.
• A memory access that generates an MMU fault, an MPU fault, or a synchronous Watchpoint debug event
must not generate an external abort.
• All other synchronous exceptions are mutually exclusive and are derived from a decode of the instruction.
For more information, see:
• Debug event prioritization on page C3-2064 for information about the prioritization of debug events,
including their prioritization relative to MMU faults, MPU faults, and synchronous external aborts
B1-1168 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
• Prioritization of aborts on page B5-1760, for information about the prioritization of aborts on a single
memory access in a PMSA implementation.
• An asynchronous exception that is pending before one of the following context synchronizing events is taken
before the first instruction after the context synchronizing event completes its execution, provided that the
pending asynchronous event is not masked after the context synchronizing event. The context synchronizing
events are:
— Execution of an ISB instruction.
— Taking an exception.
— Return from an exception.
— Exit from Debug state.
The ISR identifies any pending asynchronous exceptions.
Note
If the first instruction after the context synchronizing event generates a synchronous exception, then the
architecture does not define the order in which that synchronous exception and the asynchronous exception
are taken.
Note
The taking of an unmasked asynchronous exception in finite time must occur with all code sequences,
including with a sequence that consists of unconditional loops.
Within these limits, the prioritization of asynchronous exceptions relative to other exceptions, both synchronous and
asynchronous, is IMPLEMENTATION DEFINED.
Note
A special requirement applies to asynchronous watchpoints, see Debug event prioritization on page C3-2064.
The CPSR includes a mask bit for each type of asynchronous exception. Setting one of these bits to 1 can prevent
the corresponding asynchronous exception from being taken, see Summaries of asynchronous exception behavior
on page B1-1185.
Note
The subset of the CPSR mask bits that is set on taking an exception can prioritize the execution of FIQ handlers over
that of IRQ and asynchronous abort handlers.
1. The hardware determines the mode to which the exception must be taken, see Processor mode for taking
exceptions on page B1-1172.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1169
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
2. A link value, indicating the preferred return address for the exception, is saved. This is a possible return
address for the exception handler, and depends on:
• The exception type.
• Whether the exception is taken to a PL1 mode or a PL2 mode.
• For some exceptions taken to a PL1 mode, the instruction set state when the exception is taken.
Where the link value is saved depends on whether the exception is taken to a PL1 mode or a PL2 mode.
For more information see Link values saved on exception entry on page B1-1171.
3. The value of the CPSR is saved in the SPSR for the mode to which the exception must be taken. The value
saved in SPSR.IT[7:0] is always correct for the preferred return address.
5. The CPSR is updated with new context information for the exception handler. This includes:
• Setting CPSR.M to the processor mode to which the exception is taken.
• Setting the appropriate CPSR mask bits. This can disable the corresponding exceptions, preventing
uncontrolled nesting of exception handlers.
• Setting the instruction set state to the state required for exception entry.
• Setting the endianness to the required value for exception entry.
• Clearing the CPSR.IT[7:0] bits to 0.
For more information, see Processor state on exception entry on page B1-1181.
6. The appropriate exception vector is loaded into the PC, see Exception vectors and the exception base address
on page B1-1164.
For an exception taken to a PL1 mode, on exception entry, the exception handler can use the SRS instruction to store
the return state onto the stack of any mode at the same privilege level, and the CPS instruction to change mode. For
more information about the instructions, see SRS (Thumb) on page B9-1990, SRS (ARM) on page B9-1992, CPS
(Thumb) on page B9-1964, and CPS (ARM) on page B9-1966.
Later sections of this chapter describe each of the possible exceptions, and each of these descriptions includes a
pseudocode description of the processor state changes when it takes that exception. Table B1-5 gives an index to
these descriptions:
Undefined Instruction Pseudocode description of taking the Undefined Instruction exception on page B1-1207
Supervisor Call Pseudocode description of taking the Supervisor Call exception on page B1-1209
Secure Monitor Call Pseudocode description of taking the Secure Monitor Call exception on page B1-1211
Hypervisor Call Pseudocode description of taking the Hypervisor Call exception on page B1-1211
Prefetch Abort Pseudocode description of taking the Prefetch Abort exception on page B1-1213
Data Abort Pseudocode description of taking the Data Abort exception on page B1-1214
B1-1170 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Hyp Trap Pseudocode description of taking the Hyp Trap exception on page B1-1209
Virtual Abort Pseudocode description of taking the Virtual Abort exception on page B1-1217
Virtual IRQ Pseudocode description of taking the Virtual IRQ exception on page B1-1220
Virtual FIQ Pseudocode description of taking the Virtual FIQ exception on page B1-1222
The following sections give more information about the processor state changes, for different architecture
implementations. However, you must refer to the pseudocode for a full description of the state changes:
• Processor mode for taking exceptions on page B1-1172.
• Processor state on exception entry on page B1-1181.
Supervisor Call Address of the instruction after the SVC instruction PL1 a or PL2 b
Secure Monitor Call Address of the instruction after the SMC instruction PL1, and only in Secure state
Hypervisor Call Address of the instruction after the HVC instruction PL2 only b
Data Abort Address of instruction that generated the abort PL1 a or PL2 b
Virtual Abort Address of next instruction to execute PL1, and only in Non-secure state
Virtual IRQ or Virtual FIQ Address of next instruction to execute PL1, and only in Non-secure state
a. Secure or Non-secure.
b. PL2 is implemented only in Non-secure state. Therefore, an exception can be taken to PL2 mode only if it is taken from Non-secure state.
Note
• Although Reset is described as an exception, it differs significantly from other exceptions. The architecture
has no concept of a return from a Reset and therefore it is not listed in this section.
• For each exception, the preferred return address is not affected by whether the exception is taken from a PL1
mode or from a PL0 mode.
However, the link value saved, and where it is saved, depend on whether the exception is taken to a PL1 mode, or
to a PL2 mode, as follows:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1171
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
The saved link value is the preferred return address for the exception, plus an offset that depends on
the instruction set state when the exception was taken, as Table B1-7 shows:
Table B1-7 Offsets applied to Link value for exceptions taken to PL1 modes
Undefined Instruction +4 +2 -b
Prefetch Abort +4 +4 +4
Data Abort +8 +8 +8
Virtual Abort +8 +8 +8
IRQ or FIQ +4 +4 +4
• Configuration options and other features provided by the Security Extensions and the Virtualization
Extensions can determine the mode to which some exceptions are taken, as follows:
In an implementation that does not include the Security Extensions
An exception is always taken to the default mode for that exception.
Note
An implementation that includes the Virtualization Extensions must also include the Security
Extensions.
B1-1172 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
If the implementation does not include the Virtualization Extensions, any exception taken from
Non-secure state that is not taken to Secure Monitor mode is taken to Non-secure state in the
default mode for that exception.
In an implementation that includes the Virtualization Extensions
An exception taken from Non-secure state that is not taken to Secure Monitor mode is taken to
Non-secure state and:
• If the exception is taken from Hyp mode then it is taken to Hyp mode.
• Otherwise, the exception is either taken to Hyp mode, as described in Exceptions taken to
Hyp mode, or taken to the default mode for the exception.
Note
The Virtualization Extensions have no effect on the handling of exceptions taken from Secure
state.
Table B1-4 on page B1-1166 shows the default mode to which each exception is taken.
Asynchronous exception routing controls on page B1-1174 describes the exception routing controls provided by the
Security Extensions and the Virtualization Extensions.
For a VMSA implementation, Routing of aborts on page B3-1393 gives more information about the modes to which
memory aborts are taken.
Summary of the possible modes for taking each exception on page B1-1174 shows all modes to which each
exception might be taken, in any implementation. That is, it applies to implementations:
• That include neither the Security Extensions, nor the Virtualization Extensions.
• That include the Security Extensions, but not the Virtualization Extensions.
• That include both the Security Extensions and the Virtualization Extensions.
• Any exception taken from Hyp mode, that is not routed to Secure Monitor Mode by the controls described
in Asynchronous exception routing controls on page B1-1174, is taken to Hyp mode.
• The following exceptions, if taken from Non-secure state, are taken to Hyp mode:
— An abort that Routing of aborts on page B3-1393 identifies as taken to Hyp mode.
— A Hyp Trap exception, see Traps to the hypervisor on page B1-1246.
— A Hypervisor Call exception. This is generated by executing a HVC instruction in a Non-secure mode.
— An asynchronous abort, IRQ exception or FIQ exception that is not routed to Secure Monitor mode
but is explicitly routed to Hyp mode, as described in Asynchronous exception routing controls on
page B1-1174.
— A synchronous external abort, Alignment fault, Undefined Instruction exception, or Supervisor Call
exception taken from the Non-secure PL0 mode and explicitly routed to Hyp mode, as described in
Routing general exceptions to Hyp mode on page B1-1190.
Note
A synchronous external abort can be routed to Hyp mode only if it not routed to Secure Monitor mode.
— A debug exception that is explicitly routed to Hyp mode as described in Routing Debug exceptions to
Hyp mode on page B1-1193.
Note
The virtual exceptions cannot be taken to Hyp mode. They are always taken to a Non-secure PL1 mode.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1173
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
SCR.EA When this bit is set to 1, any external abort is taken to Secure Monitor mode.
Note
• Unlike other controls described in this section, SCR.EA controls the routing of both
synchronous and asynchronous external aborts.
• The other classes of abort cannot be routed to Monitor mode. For more information about the
classification of aborts, see VMSA memory aborts on page B3-1392 or PMSA memory aborts
on page B5-1757.
SCR.FIQ When this bit is set to 1, any FIQ exception is taken to Secure Monitor mode.
SCR.IRQ When this bit is set to 1, any IRQ exception is taken to Secure Monitor mode.
HCR.AMO If SCR.EA is set to 0, when this bit is set to 1, an asynchronous external abort taken from a
Non-secure PL1 or PL0 mode is taken to Hyp mode, instead of to Non-secure Abort mode.
HCR.FMO If SCR.FIQ is set to 0, when this bit is set to 1, an FIQ exception taken from a Non-secure PL1 or
PL0 mode is taken to Hyp mode, instead of to Non-secure FIQ mode.
HCR.IMO If SCR.IRQ is set to 0, when this bit is set to 1, an IRQ exceptions taken from a Non-secure PL1 or
PL0 mode is taken to Hyp mode, instead of to Non-secure IRQ mode.
Only software executing in Hyp mode, or Secure software executing in Monitor mode when SCR.NS is set to 1, can
change the values of these bits.
The HCR.{AMO, FMO, IMO} bits also affect the masking of asynchronous exceptions in Non-secure state, as
described in Asynchronous exception masking on page B1-1183.
The SCR.{EA, FIQ, IRQ} and HCR.{AMO, FMO, IMO} bits have no effect on the routing of Virtual Abort, Virtual
FIQ, and Virtual IRQ exceptions.
B1-1174 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
These descriptions also show the vector offset for the exception entry for each mode.
• Vector offsets, see Exception vectors and the exception base address on page B1-1164.
• The routing of external aborts, IRQ and FIQ exceptions, and the virtual exceptions, see Asynchronous
exception routing controls on page B1-1174.
Figure B1-3 shows how the implementation, state, and configuration options determine the mode to which an
Undefined Instruction exception is taken.
Have
Virtualization Taken from Hyp mode,
Yes Yes
Extensions Hyp mode vector offset 0x04
? ?
From User mode only. The
No No
effect of executing in a PL1
mode with HCR.TGE set to
1 is UNPREDICTABLE.
HCR.TGE Hyp mode,
Yes
== 1 vector offset 0x14
?
No
Non-secure Undefined mode,
vector offset 0x04
Figure B1-4 on page B1-1176 shows how the implementation, state, and configuration options determine the mode
to which a Supervisor Call exception is taken.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1175
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Have
Virtualization Taken from Hyp mode,
Yes Yes
Extensions Hyp mode vector offset 0x08
? ?
No No From User mode only. The
effect of executing in a PL1
mode with HCR.TGE set to
1 is UNPREDICTABLE.
HCR.TGE Hyp mode,
Yes
== 1 vector offset 0x14
?
No
Non-secure Supervisor mode,
vector offset 0x08
The Secure Monitor Call exception is supported only as part of the Security Extensions. A Secure Monitor Call
exception is taken to Monitor mode, using vector offset 0x08 from the Monitor exception base address.
Note
An SMC instruction that is trapped to Hyp mode because HCR.TSC is set to 1 generates a Hyp Trap exception, see
The mode to which the Hyp Trap exception is taken.
The Hyp Trap exception is supported only as part of the Virtualization Extensions. A Hyp Trap exception is taken
to Hyp mode, using a vector offset of 0x14 from the Hyp exception base address.
B1-1176 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Figure B1-6 shows how the implementation, state, and configuration options determine the mode to which a
Prefetch Abort exception is taken.
Have
Virtualization Taken from Hyp mode, vector
Yes Yes
Extensions Hyp mode offset 0x0C
? ? From User mode only. The effect of
No No executing in a PL1 mode with
HCR.TGE set to 1 is UNPREDICTABLE.
External
Yes HCR.TGE Yes
abort
== 1
?
?
No No
1
Debug HDCR.TDE Hyp mode, vector
Yes Yes
exception == 1 offset 0x14
? ?
No No
On address
translation
1
Stage 2
Yes
abort
?
1
No
Non-secure Abort mode,
vector offset 0x0C
Figure B1-7 on page B1-1178 shows how the implementation, state, and configuration options determine the mode
to which a Data Abort exception is taken.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1177
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Have
Virtualization Taken from Hyp mode, vector
Yes Yes
Extensions Hyp mode offset 0x10
? ?
No No
Alignment
Yes
fault
? From User mode only. The
No effect of executing in a PL1
mode with HCR.TGE set to
1 is UNPREDICTABLE.
External HCR.TGE
abort Yes Synchronous Yes Yes
? == 1
? ?
No No No
1
HCR.AMO Yes
== 1
?
No
1
Debug HDCR.TDE Hyp mode, vector
exception Yes Yes
== 1 offset 0x14
? ?
On address No No
translation
1
Stage 2
abort Yes
?
No 1
Non-secure Abort mode,
vector offset 0x10
B1-1178 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
The Virtual Abort exception is supported only as part of the Virtualization Extensions. A Virtual Abort exception is
taken from a Non-secure PL1 or PL0 mode, and is taken to Non-secure Abort mode, using a vector offset of 0x10
from the Non-secure exception base address.
For more information about this exception see Virtual exceptions in the Virtualization Extensions on page B1-1196.
Figure B1-8 shows how the implementation, state, and configuration options determine the mode to which an IRQ
exception is taken.
For more information about this exception see Virtual exceptions in the Virtualization Extensions on page B1-1196.
Figure B1-8 shows how the implementation, state, and configuration options determine the mode to which an FIQ
exception is taken.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1179
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
The Virtual FIQ exception is supported only as part of the Virtualization Extensions. A Virtual FIQ exception is
taken from a Non-secure PL1 or PL0 mode, and is taken to Non-secure FIQ mode, using a vector offset of 0x1C from
the Non-secure exception base address.
For more information about this exception see Virtual exceptions in the Virtualization Extensions on page B1-1196.
B1-1180 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
1 0 1 Thumb
Hyp 0 x 0 0 ARM
1 x 0 1 Thumb
When an implementation includes the Security Extensions, SCTLR is Banked for Secure and Non-secure states, and
therefore the TE bit value might be different for Secure and Non-secure states. For an exception taken to a Secure
or Non-secure PL1 mode, the SCTLR.TE bit for the security state to which the exception is taken determines the
instruction set state for the exception handler. This means the PL1 exception handlers might run in different
instruction set states, depending on the security state.
Exception mode HSCTLR.EE SCTLR.EE Endianness for data loads and stores CPSR.E
1 Big-endian 1
Hyp 0 x Little-endian 0
1 x Big-endian 1
For more information, see the bit description in Format of the CPSR and SPSRs on page B1-1148.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1181
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Table B1-10 shows the cases where CPSR.{A, I, F} bits are set to 1 on an exception entry, and how this depends on
the mode and security state to which an exception is taken. If the table entry for a particular mode and security state
does not define a value for a CPSR.{A, I, F} bit then that bit is unchanged by the exception entry. In this table:
• The Exception mode column is the mode to which the exception is taken.
• The Non-secure, no Virtualization Extensions column applies to exceptions taken to Non-secure state in an
implementation that includes the Security Extensions but not the Virtualization Extensions.
Note
Compared to an implementation that includes only the Security Extensions, implementing the Virtualization
Extensions changes both the effects of the SCR.{AW, FW} bits and the interpretation of the CPSR.{A, F} bits.
Asynchronous exception masking on page B1-1183 summarizes the behavior for both of these implementation
options.
B1-1182 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
In an ARMv7 implementation that does not include the Security Extensions, setting one of these bits to 1 masks the
corresponding exception, meaning the exception cannot be taken.
In an implementation that includes the Security Extensions, the SCR.{AW, FW} bits provide a mechanism to
prevent use of the CPSR.{A, F} mask bits by Non-secure software. In an implementation that includes the
Virtualization Extensions:
• HCR.{AMO, FMO} modify this mechanism.
• HCR.IMO can prevent the masking, by CPSR.I, of IRQs taken from Non-secure state.
Implementation that includes the Security Extensions but not the Virtualization Extensions
When an SCR.{AW, FW} bit is set to 0, Non-secure software cannot update the corresponding
CPSR bit. This means:
• When SCR.AW is set to 0, CPSR.A cannot be updated in Non-secure state.
• When SCR.FW is set to 0, CPSR.F cannot be updated in Non-secure state.
Note
There is no control of updates to CPSR.I. CPSR.I can be updated in either security state.
Implementation that includes the Security Extensions and the Virtualization Extensions
When an HCR.{AMO, IMO, FMO} mask override bit is set to 1, the value of the corresponding
CPSR.{A, I, F} bit is ignored when both of the following apply:
• The exception is taken from Non-secure state.
• Either:
— The corresponding SCR.{EA, IRQ, FIQ} bit routes the exception to Monitor mode.
— The exception is taken from a Non-secure mode other than Hyp mode.
In addition, when an SCR.{AW, FW} bit is set to 0, the value of the corresponding CPSR.{A, F}
bit is ignored when all of the following apply:
• The exception is taken from Non-secure state.
• The corresponding SCR.{EA, FIQ} bit routes the exception to Monitor mode.
• The corresponding HCR.{AMO, FMO} mask override bit is set to 0.
This means that the controls on each of the CPSR mask bits, and the effect of those bits, are as shown
in the following tables.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1183
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Table B1-11 shows the controls of the masking of asynchronous exceptions by CPSR.A.
1 0 x Ignored
1 x x Ignored
Table B1-12 shows the controls of the masking of FIQ exceptions by CPSR.F:
1 x Ignored
Table B1-13 shows the controls of the masking of FIQ exceptions by CPSR.F:
1 0 x Ignored
1 x x Ignored
The values of SCR.{AW, FW} do not affect whether CPSR.{A, F} can be updated in Non-secure
state.
Mask override bits in the Virtualization Extensions on page B1-1185 gives more information about
the HCR.{AMO, IMO, FMO} bits.
B1-1184 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
These bits can also affect the routing of the corresponding physical exceptions, see Asynchronous exception routing
controls on page B1-1174.
The HCR mask override bits have no effect on exceptions taken to Secure state.
If an HCR mask override bit is set to 1, when the processor is in Non-secure state and not in Hyp mode:
• If the corresponding physical exception is not routed to Monitor mode, the physical exception is taken to Hyp
mode.
• If the corresponding virtual exception bit in the HCR is set to 1, and the corresponding CPSR mask bit is not
set to 1, the virtual exception is signaled to the processor.
When the processor is in Hyp mode, if an HCR mask override bit is set to 1 the corresponding CPSR mask bit cannot
mask the corresponding physical exception if that exception is routed to Monitor mode.
Note
When the processor is in Hyp mode:
• Physical asynchronous exceptions that are not routed to Monitor mode are taken to Hyp mode.
• Virtual exceptions are not signaled to the processor.
The Security Extensions and Virtualization Extensions introduce controls that affect:
• The routing of these exceptions, see Asynchronous exception routing controls on page B1-1174.
• Masking of these exceptions in Non-secure state, see Asynchronous exception masking on page B1-1183.
This section summarizes the effect of these controls, for each of the asynchronous exceptions. Because the
Virtualization Extensions change the behavior of some of the Security Extensions controls, it gives separate
summaries for implementations that include and do not include the Virtualization Extensions.
Note
• In an implementation that includes the Security Extensions but does not include the Virtualization
Extensions, the following configurations permit the Non-secure state to deny service to the Secure state.
Therefore, ARM recommends that, wherever possible, these configurations are not used:
— Setting SCR.IRQ to 1. With this configuration, Non-secure PL1 software can set CPSR.I to 1, denying
the required routing of IRQs to Monitor mode.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1185
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
— Setting SCR.FW to 1 when SCR.FIQ is set to 1. With this configuration, Non-secure PL1 software can
set CPSR.F to 1, denying the required routing of FIQs to Monitor mode.
The changes introduced by the Virtualization Extensions remove these possible denials of service.
• Interrupts driven by Secure peripherals are called Secure interrupts. When SCR.FW = 0 and SCR.FIQ = 1,
FIQ exceptions can be used as Secure interrupts. These enter Secure state in a deterministic way.
Table B1-14 shows how SCR.{AW, EA} control asynchronous abort behavior.
Note
The values of SCR.EA and CPSR.A have no effect on the behavior of asynchronous watchpoints.
B1-1186 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Table B1-16 shows how SCR.{FIQ, FW} control FIQ exception behavior.
These summaries include the behavior of the virtual exceptions. See Virtual exceptions in the Virtualization
Extensions on page B1-1196 for more information about these exceptions. To distinguish them from the virtual
exceptions, the asynchronous aborts defined for an ARMv7 implementation that does not include the Virtualization
Extensions are described as physical aborts. That is, they are described as physical asynchronous aborts, physical
IRQs, and physical FIQs.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1187
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Note
As stated in Vectored interrupt support on page B1-1167, the Virtualization Extensions do not support the vectoring
of IRQ or FIQ exceptions that are routed to Hyp mode. Therefore, if at least one of HCR.IMO and HCR.FMO is set
to 1, the processor behaves as if the Non-secure SCTLR.VE bit is set to 0, regardless of the actual value of that bit.
Table B1-17 shows how SCR.{AW, EA} and HCR.AMO control asynchronous abort behavior in an
implementation that includes the Virtualization Extensions. In such an implementation, CPSR.A can be modified in
Secure and Non-secure PL1 modes and in Hyp mode, regardless of the value of SCR.AW.
B1-1188 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Table B1-18 shows how SCR.IRQ and HCR.IMO control IRQ exception behavior, in an implementation that
includes the Virtualization Extensions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1189
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Table B1-19 shows how SCR.{FIQ, FW} and HCR.FMO control FIQ exception behavior, in an implementation that
includes the Virtualization Extensions. In such an implementation, CPSR.F can be modified in Secure and
Non-secure PL1 modes and in Hyp mode, regardless of the value of SCR.FW.
Note
The routing provided by setting HCR.TGE to 1 permits applications that run in User mode to run on a hypervisor,
in Hyp mode, without a Guest OS running in a Non-secure PL1 mode. Many UNPREDICTABLE definitions associated
with setting HCR.TGE to 1 are based on this usage model.
B1-1190 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
When HCR.TGE is set to 1, and the processor is in Non-secure User mode, the following exceptions are taken to
Hyp mode, instead of to the default Non-secure mode for handling the exception:
• Any Alignment fault other than an alignment fault caused by the memory type when SCTLR.M is 1.
Note
If SCTLR.M and HCR.TGE are both 1 then behavior is UNPREDICTABLE.
The following sections give more information about the behavior when each of these exceptions is routed in this
way:
• Undefined Instruction exception, when HCR.TGE is set to 1.
• Supervisor Call exception, when HCR.TGE is set to 1.
• Synchronous external abort, when HCR.TGE is set to 1 on page B1-1192.
• Alignment fault, when HCR.TGE is set to 1 on page B1-1192.
The effect of executing in any of the following states with HCR.TGE set to 1 is UNPREDICTABLE:
• In a Non-secure PL1 mode.
• In Non-secure User mode if either:
— SCTLR.M is set to 1.
— One or more of HDCR.{TDE, TDA, TDRA, TDOSA} is set to 0.
The HSR reports that entry to Hyp mode was because of a Supervisor Call exception, and:
• If the SVC is unconditional, takes for the imm16 value in the HSR:
— A zero-extended 8-bit immediate value for the Thumb SVC instruction.
Note
The only Thumb encoding for SVC is a 16-bit instruction encoding.
— The bottom16 bits of the immediate value for the ARM SVC instruction.
If the SVC is conditional, the processor takes the exception only if it passes its condition code check.
The HSR reports the exception as a Supervisor Call exception taken to Hyp mode, using the EC value 0x11. For
more information, see Use of the HSR on page B3-1421.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1191
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Note
The effect of setting HCR.TGE to 1 is to route the Supervisor Call exception to Hyp mode, not to trap the execution
of the SVC instruction. This means that the preferred return address for the exception, when routed to Hyp mode in
this way, is the instruction after the SVC instruction.
Note
When SCR.EA is set to 1, external aborts are routed to Secure Monitor mode, and this takes priority over the
HCR.TGE routing. For more information, see Asynchronous exception routing controls on page B1-1174. The
SCR.EA control described in that section applies to both synchronous and asynchronous external aborts.
If an instruction that causes this exception is conditional, the processor takes the exception only if the instruction
passes its condition code check.
For more information about the exception reporting, see Use of the HSR on page B3-1421.
Unaligned data access on page A3-106 summarizes the Alignment faults that are trapped.
In these cases, the attempted execution generates a Hyp Trap exception, instead of a Data Abort exception. When
the Hyp Trap exception is taken, the HSR reports that a Data Abort caused the Hyp Trap exception entry, and
presents a valid syndrome.
When the Non-secure SCTLR.M bit is set to 1, enabling the Non-secure PL1&0 stage 1 MMU, an
otherwise-permitted unaligned access to Device or Strongly-ordered memory generates an Alignment fault.
However, having HCR.TGE set to 1 when SCTLR.M is set to 1 is generally UNPREDICTABLE.
If an instruction that causes this exception is conditional, the processor takes the exception only if the instruction
passes its condition code check.
The HSR reports the exception as a Data Abort routed to Hyp mode, using the EC value 0x24, see Use of the HSR
on page B3-1421.
B1-1192 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
• Debug exceptions associated with instruction fetch, that would otherwise generate a Prefetch Abort
exception. These are exceptions generated by the Breakpoint, BKPT instruction, and Vector catch debug
events, see Debug exception on BKPT instruction, Breakpoint, or Vector catch debug events on
page C4-2076.
• Debug exceptions associated with data accesses, that would otherwise generate a Data Abort exception.
These are exceptions generated by the Watchpoint debug event, see Debug exception on Watchpoint debug
event on page C4-2077.
When HDCR.TDE is set to 1, the HDCR.{TDRA, TDOSA, TDA} bits must all be set to 1, otherwise behavior is
UNPREDICTABLE.
See also Permitted combinations of HDCR.{TDRA, TDOSA, TDA, TDE} bits on page B1-1259.
Note
• A debug event generates a debug exception only when invasive debug is enabled and Monitor debug-mode
is selected, see About debug exceptions on page C4-2076. When Halting debug-mode is selected, a debug
event causes Debug state entry and cannot be trapped to Hyp mode.
• When HDCR.TDE is set to 1, the Hyp Trap exception is generated instead of the Prefetch Abort exception
or Data Abort exception that is otherwise generated by the Debug exception.
• Debug exceptions, other than the exception on the BKPT instruction, are not permitted in Hyp mode.
When a Hyp Trap exception is generated because HDCR.TDE is set to 1, The HSR reports the exception either:
• As a Prefetch Abort exception routed to Hyp mode, using the EC value 0x20.
• As a Data Abort exception routed to Hyp mode, using the EC value 0x24.
For more information see Use of the HSR on page B3-1421.
• The instruction after the instruction boundary at which an asynchronous exception was taken.
• The instruction following an SVC, SMC, or HMC instruction, for an exception generated by one of those
instructions.
• The instruction that caused the exception, after the reason for the exception has been removed.
• The subsequent instruction, if the instruction that caused the exception has been emulated in the exception
handler.
The ARM architecture defines a preferred return address for each exception other than Reset, see Link values saved
on exception entry on page B1-1171. The values of the SPSR.IT[7:0] bits generated on exception entry are always
correct for this preferred return address, but might require adjustment by the exception handler if returning
elsewhere.
In some cases, to calculate the appropriate preferred return address, a subtraction must be performed on the link
value saved on taking the exception. The description of each exception includes any value that must be subtracted
from the link value, and other information about the required exception return.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1193
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
• If the exception return is not performed by executing an RFE instruction, the value of the current SPSR at the
time of the exception return
Where the exception return is UNPREDICTABLE, the implementation can adjust the value loaded into the CPSR, to
avoid a security hole, or other undesirable behavior. For example:
• In an implementation that includes the Security Extensions, if the processor is in a Non-secure PL1 mode,
and one of the following applies:
— The restored CPSR.M value is 0b10110, the value for Monitor mode.
— NSACR.RFR is set to 1, and the restored CPSR.M value is 0b10001, the value for FIQ mode.
Note
When NSACR.RFR is set to 1, FIQ mode is reserved for Secure operation.
— If the implementation includes the Virtualization Extensions, and the restored CPSR.M value is
0b11010, the value for Hyp mode.
In this case, CPSR.M takes an UNKNOWN value that does not correspond to any of:
— Hyp mode.
— Monitor mode.
— If NSACR.RFR is set to 1, FIQ mode.
• In an implementation that includes the Virtualization Extensions, if the processor is in the Non-secure PL2
mode and one of the following applies:
— The restored CPSR.M value is 0b10110, the value for Monitor mode.
— NSACR.RFR is set to 1 and the restored CPSR.M value is 0b10001, the value for FIQ mode.
In this case, CPSR.M takes an UNKNOWN value that does not correspond to either:
— Monitor mode.
— If NSACR.RFR is set to 1, FIQ mode.
• In an implementation that includes the Virtualization Extensions, if SCR.NS is set to 0 and the restored
CPSR.M value is 0b11010, the value for Hyp mode.
In this case, CPSR.M takes an UNKNOWN value that does not correspond to Hyp mode.
• If the new CPSR.{J, T} bits correspond to an unsupported instruction set, including an instruction set that is
not supported in the mode of operation that applies immediately after the exception return, the CPSR.{J, T}
bits might be set to values that correspond to a supported instruction set. For more information see Exception
return to an unimplemented instruction set state on page B1-1196.
An example of where this might happen is a return to Hyp mode with CPSR.{J, T} set to {1, 1}, the values
for ThumbEE.
• If the new CPSR.IT bits correspond to a reserved value then CPSR.IT might be set to a permitted UNKNOWN
value. For more information see IT block state register, ITSTATE on page A2-51.
Note
The Thumb exception return instructions are all UNPREDICTABLE if executed in ThumbEE state.
B1-1194 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
For an exception taken to a PL1 mode, the ARM architecture provides the following exception return instructions:
• Data-processing instructions with the S bit set and the PC as a destination, see SUBS PC, LR (Thumb) on
page B9-1996 and SUBS PC, LR and related instructions (ARM) on page B9-1998.
Typically:
— A return where no subtraction is required uses SUBS with an operand of 0, or the equivalent MOVS
instruction.
— A return requiring subtraction uses SUBS with a nonzero operand.
• From ARMv6, the RFE instruction, see RFE on page B9-1986. If a subtraction is required, typically it is
performed before saving the LR value to memory.
• In ARM state, a form of the LDM instruction, see LDM (exception return) on page B9-1972. If a subtraction is
required, typically it is performed before saving the LR value to memory.
Hyp mode is the only PL2 mode. Both Hyp mode and the ERET instruction are implemented only as part of the
Virtualization Extensions.
{J, T} == 00 The target instruction set state is ARM state. Bits[1:0] of the address transferred to the PC are
ignored by the hardware.
{J, T} == 10 The target instruction set state is Jazelle state. In a non-trivial implementation of the Jazelle
extension, bits[1:0] of the address transferred to the PC are part of the instruction address. For the
behavior in a trivial implementation of the Jazelle extension, see Exception return to an
unimplemented instruction set state on page B1-1196. For details of the trivial implementation see
Trivial implementation of the Jazelle extension on page B1-1244.
ARM deprecates any dependence on the requirements that the hardware ignores bits of the address. ARM
recommends that the address transferred to the PC for an exception return is correctly aligned for the target
instruction set.
After an exception entry other than Reset, the LR value has the correct alignment for the instruction set indicated
by the SPSR.{J, T} bits. This means that if exception return instructions are used with the LR and SPSR values
produced by such an exception entry, the only precaution software needs to take to ensure correct alignment is that
any subtraction is of a multiple of four if returning to ARM state, or a multiple of two if returning to Thumb state
or to ThumbEE state.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1195
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
However, on some implementations, an exception return instruction might set CPSR.{J. T} to the values
corresponding to an unimplemented instruction set state, see Unimplemented instruction sets on page B1-1155. This
is most likely to happen because a faulty exception handler restores the wrong value to the CPSR.
If the processor attempts to execute an instruction while the CPSR.{J, T} bits indicate an unimplemented instruction
set state, an Undefined Instruction exception is taken. This happens if either:
• CPSR.J == 1 and CPSR.T == 1, and the processor does not support ThumbEE state.
• CPSR.J == 1 and CPSR.T == 0, and the processor does not support Jazelle state.
The Undefined Instruction exception handler can detect the cause of this exception because on entry to the handler
the SPSR.{J, T} bits indicate the unimplemented instruction set state. If the Undefined Instruction exception handler
wants to return to a valid instruction set state it can change the values its exception return instruction writes to the
CPSR.{J, T} bits.
If an exception return writes CPSR.{J, T} values that correspond to an unimplemented instruction set state, and also
writes the address of an aborting memory location to the PC, it is IMPLEMENTATION DEFINED whether:
• The instruction fetch is attempted, and a Prefetch Abort exception is taken because the memory access aborts.
• An Undefined Instruction exception is taken, without the instruction being fetched.
If an exception return writes CPSR.{J, T} values that correspond to an unimplemented instruction set, the width of
the instruction fetch is an IMPLEMENTATION DEFINED value that is 1, 2 or 4 bytes.
An implementation that supports neither of the Jazelle and ThumbEE states can implement the J bits of the PSRs as
RAZ/WI. On such an implementation, a return to an unimplemented instruction set state cannot occur.
When the corresponding HCR.{AMO, IMO, FMO} bit is set to 1, a virtual exception is generated either:
• For a Virtual IRQ or Virtual FIQ, by an IMPLEMENTATION DEFINED mechanism. This might be a signal from
an interrupt controller, for example, as defined by the ARM Generic Interrupt Controller Architecture
Specification.
A virtual exception is taken only from a Non-secure PL1 or PL0 mode. In any other mode, if the exception is
generated it is not taken.
A virtual exception is taken to Non-secure state in the default mode for the corresponding physical exception. This
means:
• A Virtual Abort is taken to Non-secure Abort mode.
• A Virtual IRQ is taken to Non-secure IRQ mode.
• A Virtual FIQ is taken to Non-secure FIQ mode.
B1-1196 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Table B1-20 summarizes the HCR bits that route asynchronous exceptions to Hyp mode, and the bits that generate
the virtual exceptions.
Exception Routing the physical exception to Hyp mode Generating the virtual exception
The HCR.{AMO, IMO, FMO} bits route the corresponding physical exception to Hyp mode only if the physical
exception is not routed to Monitor mode by the SCR.{EA, IRQ, FIQ} bit. Similarly, the HCR.{VA, VI, VF} bits
generate a virtual exception only if set to 1 when the corresponding HCR.{AMO, IMO, FMO} is set to 1. For more
information, see Asynchronous exception behavior, with the Virtualization Extensions on page B1-1187.
When an HCR.{AMO, IMO, FMO} control bit is set to 1, the corresponding mask bit in the CPSR:
• Does not mask the physical exception.
• Masks the virtual exception, if the processor is executing in a Non-secure PL1 or PL0 mode.
Taking a Virtual Abort exception clears HCR.VA to zero. Taking a Virtual IRQ exception or a Virtual FIQ exception
does not affect the value of HCR.VI or HCR.VF.
Note
This means that the exception handler for a Virtual IRQ exception or a Virtual FIQ exception must cause software
executing in Hyp mode, or in Monitor mode, to update the HCR to clear the appropriate virtual exception bit to 0.
See WFE wake-up events on page B1-1200 and Wait For Interrupt on page B1-1202 for information about how
virtual exceptions affect wake up from power-saving states.
Note
A hypervisor can use virtual exceptions to signal exceptions to the current Guest OS. The Guest OS takes a virtual
exception exactly as it would take the corresponding physical exception, and is unaware of any distinction between
virtual exceptions and the corresponding physical exceptions.
In an implementation that includes the Virtualization Extensions, the HSCTLR.FI bit is a RO bit that indicates the
current value of SCTLR.FI.
To ensure that a change between normal and low interrupt latency configurations is synchronized correctly, the
SCTLR.FI bit must be changed only in IMPLEMENTATION DEFINED circumstances. The FI bit can be changed shortly
after reset, with interrupts disabled, and before enabling any MMU, MPU, or cache, using the following sequence:
DSB
ISB
MCR p15, 0, Rx, c1, c0, c0 ; change FI bit in the SCTLR
DSB
ISB
An implementation can define other sequences and circumstances that permit the SCTLR.FI bit to be changed.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1197
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Note
• Examples of methods that might be implemented to reduce interrupt latency are:
— Disabling Hit-Under-Miss functionality in a processor.
— The abandoning of restartable external accesses.
These choices permit the processor to react to a pending interrupt faster than would otherwise be the case.
• Reducing interrupt latency can result in reduced performance overall.
A low interrupt latency configuration might permit interrupts and asynchronous aborts to be taken during a sequence
of memory transactions generated by a single load or store instruction. For details of what these sequences are and
the consequences of taking interrupts and asynchronous aborts in this way see Single-copy atomicity on
page A3-125. If the implementation permits interrupts to be taken during an LDM or STM instruction in this way, those
instructions are described as being restartable.
ARM deprecates any software reliance on the behavior that an interrupt or asynchronous abort cannot occur in a
sequence of memory transactions generated by a single load or store instruction that accesses Normal memory.
Note
A particular case that has shown this reliance is load multiples that load the stack pointer from memory. In an
implementation where an interrupt is taken during the LDM, this can corrupt the stack pointer.
B1-1198 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Example B1-1 Spinlock as an example of using Wait For Event and Send Event
A multiprocessor operating system requires locking mechanisms to protect data structures from being accessed
simultaneously by multiple processors. These mechanisms prevent the data structures becoming inconsistent or
corrupted if different processors try to make conflicting changes. If a lock is busy, because a data structure is being
used by one processor, it might not be practical for another processor to do anything except wait for the lock to be
released. For example, if a processor is handling an interrupt from a device it might need to add data received from
the device to a queue. If another processor is removing data from the queue, it will have locked the memory area
that holds the queue. The first processor cannot add the new data until the queue is in a consistent state and the lock
has been released. It cannot return from the interrupt handler until the data has been added to the queue, so it must
wait.
• A processor requiring access to the protected data attempts to obtain the lock using single-copy atomic
synchronization primitives such as the Load-Exclusive and Store-Exclusive operations described in
Synchronization and semaphores on page A3-112.
• If the processor obtains the lock it performs its memory operation and releases the lock.
• If the processor cannot obtain the lock, it reads the lock value repeatedly in a tight loop until the lock becomes
available. At this point it again attempts to obtain the lock.
• In a low-power system the tight read loop is undesirable because it uses energy to no effect.
• In a multi-threaded processor the execution of spin-locks by waiting threads can significantly degrade overall
performance.
Using the Wait For Event and Send Event mechanism can improve the energy efficiency of a spinlock. In this
situation, a processor that fails to obtain a lock can execute a Wait For Event instruction, WFE, to request entry to a
low-power state. When a processor releases a lock, it must execute a Send Event instruction, SEV, causing any
waiting processors to wake up. Then, these processors can attempt to gain the lock again.
The Virtualization Extensions provide a bit that traps to Hyp mode any attempt to enter a low-power state from a
Non-secure PL1 or PL0 mode. For more information see Trapping use of the WFI and WFE instructions on
page B1-1253.
The architecture does not define the exact nature of the low power state, but the execution of a WFE instruction must
not cause a loss of memory coherency.
Note
Although a complex operating system can contain thousands of distinct locks, the event sent by this mechanism does
not indicate which lock has been released. If the event relates to a different lock, or if another processor acquires the
lock more quickly, the processor fails to acquire the lock and can re-enter the low-power state waiting for the next
event.
The Wait For Event system relies on hardware and software working together to achieve energy saving:
• The hardware provides the mechanism to enter the Wait For Event low-power state.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1199
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
As shown in the list of wake-up events, an implementation can include IMPLEMENTATION DEFINED hardware
mechanisms to generate wake-up events.
Note
For more information about CPSR masking see Asynchronous exception masking on page B1-1183. If the
configuration of the masking controls provided by the Security Extensions, or Virtualization Extensions, mean that
a CPSR mask bit cannot mask the corresponding exception, then the physical exception is a WFE wake-up event,
regardless of the value of the CPSR mask bit.
As shown in this list, the Event Register might be set by IMPLEMENTATION DEFINED mechanisms.
B1-1200 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
Software cannot read or write the value of the Event Register directly.
Note
A DSB instruction ensures that no instruction, including any SEV instruction, that appears in program order after the
DSB instruction, can execute until the DSB instruction has completed. For more information, see Data Synchronization
Barrier (DSB) on page A3-150.
The Send Event instruction is available at all privilege levels, see SEV on page A8-607.
An implementation can merge two or more events sent by two or more instances of SEV execution into a single
write to the event register and a single WFE wake-up event for a processor.
• If the Event Register is set, the instruction clears the register and completes immediately. Normally, if this
happens the software makes another attempt to claim the lock.
• If the Event Register is clear the processor can suspend execution and enter a low-power state. It can remain
in that state until the processor detects a WFE wake-up event or a reset. When the processor detects a WFE
wake-up event, or earlier if the implementation chooses, the WFE instruction completes.
The Wait For Event instruction, WFE, is available at all privilege levels, see WFE on page A8-1105.
Software using the Wait For Event mechanism must tolerate spurious wake-up events, including multiple wake ups.
The Virtualization Extensions provide a bit that traps to Hyp mode any attempt to enter a low-power state from a
Non-secure PL1 or PL0 mode. For more information see Trapping use of the WFI and WFE instructions on
page B1-1253.
The ClearEventRegister() pseudocode procedure clears the Event Register of the current processor.
The EventRegistered() pseudocode function returns TRUE if the Event Register of the current processor is set and
FALSE if it is clear:
boolean EventRegistered()
The WaitForEvent() pseudocode procedure optionally suspends execution until a WFE wake-up event or reset
occurs, or until some earlier time if the implementation chooses. It is IMPLEMENTATION DEFINED whether restarting
execution after the period of suspension causes a ClearEventRegister() to occur.
The SendEvent() pseudocode procedure sets the Event Register of every processor in the multiprocessor system.
The SendEventLocal() pseudocode procedure sets the Event Register of the processor that executes the
SendEventLocal() procedure.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1201
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.8 Exception handling
Note
ARMv7 redefines the CP15 c7 encoding previously used for WFI as UNPREDICTABLE, see Retired operations on
page B3-1494 and Retired operations on page B5-1796.
When a processor issues a WFI instruction it can suspend execution and enter a low-power state.
The Virtualization Extensions provide a bit that traps to Hyp mode any attempt to enter a low-power state from a
Non-secure PL1 or PL0 mode. For more information see Trapping use of the WFI and WFE instructions on
page B1-1253.
The processor can remain in the WFI low-power state until it is reset, or it detects one of the following WFI wake-up
events:
• A physical IRQ interrupt, regardless of the value of the CPSR.I bit.
• A physical FIQ interrupt, regardless of the value of the CPSR.F bit.
• A physical asynchronous abort, regardless of the value of the CPSR.A bit.
• In Non-secure state in any mode other than Hyp mode:
— When HCR.IMO is set to 1, a virtual IRQ interrupt, regardless of the value of the CPSR.I bit.
— When HCR.FMO is set to 1, a virtual FIQ interrupt, regardless of the value of the CPSR.F bit.
— When HCR.AMO is set to 1, a virtual asynchronous abort, regardless of the value of the CPSR.A bit.
• An asynchronous debug event, when invasive debug is enabled and the debug event is permitted.
An implementation can include other IMPLEMENTATION DEFINED hardware mechanisms to generate WFI wake-up
events.
When the hardware detects a WFI wake-up event, or earlier if the implementation chooses, the WFI instruction
completes.
WFI wake-up events cannot be masked by the mask bits in the CPSR.
The architecture does not define the exact nature of the low power state, but the execution of a WFI instruction must
not cause a loss of memory coherency.
Note
• Because debug events are WFI wake-up events, ARM strongly recommends that Wait For Interrupt is used
as part of an idle loop rather than waiting for a single specific interrupt event to occur and then moving
forward. This ensures the intervention of debug while waiting does not significantly change the function of
the program being debugged.
• In some previous implementations of Wait For Interrupt, the idle loop is followed by exit functions that must
be executed before taking the interrupt. The operation of Wait For Interrupt remains consistent with this
model, and therefore differs from the operation of Wait For Event.
• Some implementations of Wait For Interrupt drain down any pending memory activity before suspending
execution. This increases the power saving, by increasing the area over which clocks can be stopped. The
ARM architecture does not require this operation, and software must not rely on Wait For Interrupt operating
in this way.
B1-1202 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.8 Exception handling
The control logic required to do this tracks the activity of the bus interfaces of the processor. This means it can signal
to an external power controller that there is no ongoing bus activity.
However, the processor must continue to process memory-mapped and external debug interface accesses to debug
registers when in the WFI state. The indication of idle state to the system normally only applies to the functional
interfaces of the processor, not the debug interfaces.
On an implementation that includes v7.1 Debug, when DBGPRSR.DLK, the OS Double Lock status bit, is set to 1,
the processor must not signal this idle state to the processor unless it can guarantee, also, that the debug interface is
idle. For more information about OS Double Lock, see Permissions in relation to locks on page C6-2106.
Note
In a processor that implements separate core and debug power domains, the debug interface referred to in this
section is the interface between the core and debug power domains, since the signal to the power controller indicates
that the core power domain is idle. For more information about the power domains see Power domains and debug
on page C7-2137.
The exact nature of this interface is IMPLEMENTATION DEFINED, but the use of Wait For Interrupt as the only
architecturally-defined mechanism that completely suspends execution makes it very suitable as the preferred
powerdown entry mechanism.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1203
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
Additional pseudocode functions for exception handling on page B1-1223 gives additional pseudocode that is used
in the pseudocode descriptions of a number of the exceptions.
B1.9.1 Reset
On an ARM processor, when the Reset input is asserted the processor stops execution. When Reset is deasserted,
the processor then starts executing instructions:
• In Secure state, if it implements the Security Extensions.
• In Supervisor mode, with interrupts disabled.
Reset returns some processor state to architecturally-defined or IMPLEMENTATION DEFINED values, and makes other
state UNKNOWN. For more information see:
• For a VMSAv7 implementation:
— Behavior of the caches at reset on page B2-1267.
— Enabling MMUs on page B3-1314.
— TLB behavior at reset on page B3-1375.
— Reset behavior of CP14 and CP15 registers on page B3-1446.
• For a PMSAv7 implementation:
— Behavior of the caches at reset on page B2-1267.
— Enabling and disabling the MPU on page B5-1750.
— Reset behavior of CP14 and CP15 registers on page B5-1770.
• From the low or high reset vector address, 0x00000000 or 0xFFFF0000, as determined by the reset value of the
SCTLR.V bit. This reset value can be determined by an IMPLEMENTATION DEFINED configuration input
signal.
When executions starts, system behavior depends on the reset value of the CPSR, as defined by the TakeReset()
pseudocode function that is defined later in this section. See also The Current Program Status Register (CPSR) on
page B1-1147.
The ARM architecture does not define any way of returning to a previous execution state from a reset.
Note
• A Reset exception does not reset the value of all of the debug registers. For more information see Reset and
debug on page C7-2148.
B1-1204 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
• The ARM architecture does not distinguish between multiple levels of reset. A system can provide multiple
distinct levels of reset that reset different parts of the system. These all correspond to this single reset
exception.
// TakeReset()
// ===========
TakeReset()
// Enter Supervisor mode and (if relevant) Secure state, and reset CP15. This affects
// the Banked versions and values of various registers accessed later in the code.
// Also reset other system components.
CPSR.M = '10011'; // Supervisor mode
if HaveSecurityExt() then SCR.NS = '0';
ResetControlRegisters();
if HaveAdvSIMDorVFP() then FPEXC.EN = '0'; SUBARCHITECTURE_DEFINED further resetting;
if HaveThumbEE() then TEECR.XED = '0';
if HaveJazelle() then JMCR.JE = '0'; SUBARCHITECTURE_DEFINED further resetting;
// Further CPSR changes: all interrupts disabled, IT state reset, instruction set
// and endianness according to the SCTLR values produced by the above call to
// ResetControlRegisters().
CPSR.I = '1'; CPSR.F = '1'; CPSR.A = '1';
CPSR.IT = '00000000';
CPSR.J = '0'; CPSR.T = SCTLR.TE; // TE=0: ARM, TE=1: Thumb
CPSR.E = SCTLR.EE; // EE=0: little-endian, EE=1: big-endian
// All registers, bits and fields not reset by the above pseudocode or by the
// BranchTo() call below are UNKNOWN bitstrings after reset. In particular, the
// return information registers R14_svc and SPSR_svc have UNKNOWN values, so that
// it is impossible to return from a reset in an architecturally defined way.
The HasIMPDEFResetVector() pseudocode function returns TRUE if the implementation has an IMPLEMENTATION
DEFINED reset vector.
• A coprocessor instruction that is not accessible because of the settings in one or more of:
— The CPACR, see CPACR, Coprocessor Access Control Register, VMSA on page B4-1547, or CPACR,
Coprocessor Access Control Register, PMSA on page B6-1823.
— In an implementation that includes the Security Extensions, the NSACR.
— In an implementation that includes the Virtualization Extensions, when the processor is in Hyp mode,
the HCPTR.
• A coprocessor instruction that causes an exception during execution, for example a trapped floating-point
exception on a floating-point instruction, see Floating-point exceptions on page A2-69.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1205
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
• An attempt to execute an instruction in an unimplemented instruction set state, see Exception return to an
unimplemented instruction set state on page B1-1196.
• Division by zero in an SDIV or UDIV instruction, in an ARMv7-R implementation when the SCTLR.DZ bit is
set to 1.
Note
In an ARMv7-A implementation that includes the SDIV and UDIV instructions, division by zero always returns
a result of zero, see ARMv7 implementation requirements and options for the divide instructions on
page A4-170.
By default, an Undefined Instruction exception is taken to Undefined mode, but an Undefined Instruction exception
can be taken to Hyp mode, see Determining the mode to which the Undefined Instruction exception is taken on
page B1-1175.
Note
The only mechanism to determine the cause of an Undefined Instruction exception that is taken to Undefined mode
is analysis of the instruction indicated by the return link in the LR on exception entry. Therefore it is important that
a coprocessor only reports exceptional conditions by generating Undefined Instruction exceptions on its own
coprocessor instructions.
The preferred return address for an Undefined Instruction exception is the address of the instruction that generated
the exception. This return is performed as follows:
• If returning from Secure or Non-secure Undefined mode, the exception return uses the SPSR and LR_und
values generated by the exception entry, as follows:
— If SPSR.{J, T} are both 0, indicating that the exception occurred in ARM state, the return uses an
exception return instruction with a subtraction of 4.
— If SPSR.T is 1, indicating that the exception occurred in Thumb state or ThumbEE state, the return
uses an exception return instruction with a subtraction of 2
— If SPSR.J is 1 and SPSR.T is 0, indicating that the exception occurred in Jazelle state, then exception
return is not possible. For more information see Undefined Instruction exception in Jazelle state on
page B1-1207.
• If returning from Hyp mode, the exception return is performed by an ERET instruction, using the SPSR and
ELR_hyp values generated by the exception entry.
Note
If handling the Undefined Instruction exception requires instruction emulation, followed by return to the next
instruction after the instruction that caused the exception, the instruction emulator must use the instruction length
to calculate the correct return address, and to calculate the updated values of the IT bits if necessary.
B1-1206 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
// TakeUndefInstrException()
// =========================
TakeUndefInstrException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC minus 2 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required return
// address offsets of 2 or 4 respectively.
new_lr_value = if CPSR.T == '1' then PC-2 else PC-4;
new_spsr_value = CPSR;
vect_offset = 4;
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterHypMode() pseudocode
procedure.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1207
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
If such an instruction fails its condition check, the behavior depends on the architecture profile and the potential
cause of entry to the Undefined Instruction exception, as follows:
• In the ARMv7-R profile, the instruction executes as a NOP and does not cause an Undefined Instruction
exception.
Note
Before ARMv7, all implementations executed any instruction that failed its condition check as a NOP, even if it
would otherwise have caused an Undefined Instruction exception. An Undefined Instruction handler written for
these implementations might assume without checking that the undefined instruction passed its condition check.
Such an Undefined Instruction handler is likely to need rewriting, to check the condition is passed, before it
functions correctly on all ARMv7-A implementations.
Note
An example of this is where both:
• An instruction, or instruction class, is made UNDEFINED by some general principle, or by a configuration
field.
• A particular encoding of that instruction or instruction class is specified as UNPREDICTABLE.
A Hyp Trap exception is generated if the processor is running in a Non-secure mode other than Hyp mode, and
commits for execution an instruction that is trapped to Hyp mode. Instruction traps are enabled by setting bits to 1
in the HCR, HCPTR, HDCR, or HSTR. For more information see Traps to the hypervisor on page B1-1246.
The preferred return address for a Hyp Trap exception is the address of the trapped instruction. The exception return
is performed by an ERET instruction, using the SPSR and ELR_hyp values generated by the exception entry.
Note
The SPSR and ELR_hyp values generated on exception entry can be used, without modification, for an exception
return to re-execute the trapped instruction. If the exception handler emulates the trapped instruction, and must
return to the following instruction, the emulation of the instruction must include modifying ELR_hyp, and possibly
updating SPSR_hyp.
B1-1208 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
For related information, see General information about traps to the hypervisor on page B1-1247.
// TakeHypTrapException()
// ======================
TakeHypTrapException()
// A Hyp Trap exception is caused by executing an instruction that is trapped to Hyp mode as
// a result of a trap set by a bit in the HCR, HCPTR, HSTR or HDCR. By definition, it can
// only be generated in a Non-secure mode other than Hyp mode.
// Note that, when a Supervisor Call exception is taken to Hyp mode because HCR.TGE==1, this
// is not a trap of the SVC instruction. See the TakeSVCException() pseudocode for this case.
preferred_exceptn_return = if CPSR.T == '1' then PC-4 else PC-8;
new_spsr_value = CPSR;
EnterHypMode(new_spsr_value, preferred_exceptn_return, 20);
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterHypMode() pseudocode
procedure.
Note
• In previous versions of the ARM architecture, the SVC instruction was called SWI, Software Interrupt.
By default, a Supervisor Call exception is taken to Supervisor mode, but a Supervisor Call exception can be taken
to Hyp mode, see Determining the mode to which the Supervisor Call exception is taken on page B1-1175.
The preferred return address for a Supervisor Call exception is the address of the next instruction after the SVC
instruction. This return is performed as follows:
• If returning from Secure or Non-secure Supervisor mode, the exception return uses the SPSR and LR_svc
values generated by the exception entry, in an exception return instruction without subtraction.
• If returning from Hyp mode, the exception return is performed by an ERET instruction, using the SPSR and
ELR_hyp values generated by the exception entry.
// TakeSVCException()
// ==================
TakeSVCException()
// Determine return information. SPSR is to be the current CPSR, after changing the IT[]
// bits to give them the correct values for the following instruction, and LR is to be
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1209
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
// the current PC minus 2 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address of
// the next instruction, the SVC instruction having size 2bytes for Thumb or 4 bytes for ARM.
ITAdvance();
new_lr_value = if CPSR.T == '1' then PC-2 else PC-4;
new_spsr_value = CPSR;
vect_offset = 8;
preferred_exceptn_return = new_lr_value;
if take_to_hyp then
EnterHypMode(new_spsr_value, preferred_exceptn_return, vect_offset);
elsif route_to_hyp then
EnterHypMode(new_spsr_value, preferred_exceptn_return, 20);
else
// Enter Supervisor ('10011') mode, and ensure Secure state if initially in Monitor
// ('10110') mode. This affects the Banked versions of various registers accessed later
// in the code.
if CPSR.M == '10110' then SCR.NS = '0';
CPSR.M = '10011';
// Write return information to registers, and make further CPSR changes: IRQs disabled,
// IT state reset, instruction set and endianness set to SCTLR-configured values.
SPSR[] = new_spsr_value;
R[14] = new_lr_value;
CPSR.I = '1';
CPSR.IT = '00000000';
CPSR.J = '0'; CPSR.T = SCTLR.TE; // TE=0: ARM, TE=1: Thumb
CPSR.E = SCTLR.EE; // EE=0: little-endian, EE=1: big-endian
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterHypMode() pseudocode
procedure.
The Secure Monitor Call instruction, SMC, requests a Secure Monitor function, causing the processor to enter
Monitor mode. For more information, see SMC (previously SMI) on page B9-1988.
Note
• In previous versions of the ARM architecture, the SMC instruction was called SMI, Software Monitor Interrupt.
• In an implementation that includes the Virtualization Extensions, when the HCR.TSC bit is set to 1, execution
of an SMC instruction in a Non-secure PL1 mode is trapped to Hyp mode, and therefore generates a Hyp Trap
Exception. For more information see Trapping use of the SMC instruction on page B1-1253.
The preferred return address for a Secure Monitor Call exception is the address of the next instruction after the SMC
instruction. This return is performed using the SPSR and LR_mon values generated by the exception entry, using
an exception return instruction without a subtraction.
B1-1210 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
Note
The exception handler can return to the SMC instruction itself by returning using a subtraction of 4, without any
adjustment to the SPSR.IT[7:0] bits. If it does this, the return occurs, then interrupts or external aborts might occur
and be handled, then the SMC instruction is re-executed and another Secure Monitor Call exception occurs.
This relies on:
• The SMC instruction being used correctly, either outside an IT block or as the last instruction in an IT block,
so that the SPSR.IT[7:0] bits indicate unconditional execution.
• The Secure Monitor Call handler not changing the result of the original conditional execution test for the SMC
instruction.
// TakeSMCException()
// ==================
TakeSMCException()
// Determine return information. SPSR is to be the current CPSR, after changing the IT[]
// bits to give them the correct values for the following instruction, and LR is to be
// the current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address of
// the next instruction (with the SMC instruction always being 4 bytes in length).
ITAdvance();
new_lr_value = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
vect_offset = 8;
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterMonitorMode()
pseudocode procedure.
The Hypervisor Call instruction, HVC, requests a hypervisor function, causing the processor to enter Hyp mode. For
more information, see HVC on page B9-1970. The instruction generates a Hypervisor Call exception that is taken
to Hyp mode.
The preferred return address for a Hypervisor Call exception is the address of the next instruction after the HVC
instruction. The exception return is performed by an ERET instruction, using the SPSR and ELR_hyp values
generated by the exception entry.
Executing an HVC instruction transfers the immediate argument of the instruction to the HSR. The exception handler
retrieves the argument from the HSR, and therefore does not have to access the original HVC instruction. For more
information see Use of the HSR on page B3-1421.
// TakeHVCException()
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1211
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
// ==================
TakeHVCException()
// Determine return information. SPSR is to be the current CPSR, after changing the IT[]
// bits to give them the correct values for the following instruction, and LR is to be
// the current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address of
// the next instruction (with the HVC instruction always being 4 bytes in length).
ITAdvance();
preferred_exceptn_return = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
// Enter Hyp mode. HVC pseudocode has checked that use of HVC is valid.
// Required vector offset depends on whether current mode is Hyp mode.
if CPSR.M == '11010' then
EnterHypMode(new_spsr_value, preferred_exceptn_return, 8);
else
EnterHypMode(new_spsr_value, preferred_exceptn_return, 20);
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterHypMode() pseudocode
procedure.
Note
Asynchronous aborts on instruction fetches are reported using the Data Abort exception, see Data Abort
exception on page B1-1214.
Prefetch Abort exception entry is synchronous to the instruction whose fetch aborted.
For more information about memory aborts see:
— VMSA memory aborts on page B3-1392.
— PMSA memory aborts on page B5-1757.
• A Breakpoint, Vector catch or BKPT instruction debug event, see Debug exception on BKPT instruction,
Breakpoint, or Vector catch debug events on page C4-2076.
Note
If an implementation fetches instructions speculatively, it must handle a synchronous abort on such an instruction
fetch by:
• Generating a Prefetch Abort exception only if the instruction would be executed in a simple sequential
execution of the program.
• Ignoring the abort if the instruction would not be executed in a simple sequential execution of the program.
By default, a Prefetch Abort exception is taken to Abort mode, but a Prefetch Abort exception can be taken to
Monitor mode, or Hyp mode. For more information, see Determining the mode to which the Prefetch Abort
exception is taken on page B1-1177.
The preferred return address for a Prefetch Abort exception is the address of the aborted instruction. This return is
performed as follows:
• If returning from a PL1 mode, using the SPSR and LR values generated by the exception entry, using an
exception return instruction with a subtraction of 4. This means using:
— SPSR_abt and LR_abt if returning from Abort mode.
— SPSR_mon and LR_mon if returning from Monitor mode.
B1-1212 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
• If returning from Hyp mode, using the SPSR_hyp and ELR_hyp values generated by the exception entry,
using an ERET instruction.
// TakePrefetchAbortException()
// ============================
TakePrefetchAbortException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address
// of the current instruction plus 4.
new_lr_value = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
vect_offset = 12;
preferred_exceptn_return = new_lr_value - 4;
if route_to_monitor then
// Ensure Secure state if initially in Monitor ('10110') mode. This affects
// the Banked versions of various registers accessed later in the code.
if CPSR.M == '10110' then SCR.NS = '0';
EnterMonitorMode(new_spsr_value, new_lr_value, vect_offset);
elsif take_to_hyp then
// Note that whatever called TakePrefetchAbortException() will have set the HSR
EnterHypMode(new_spsr_value, preferred_exceptn_return, vect_offset);
elsif route_to_hyp then
// Note that whatever called TakePrefetchAbortException() will have set the HSR
EnterHypMode(new_spsr_value, preferred_exceptn_return, 20);
else
// Handle in Abort mode. Ensure Secure state if initially in Monitor mode. This
// affects the Banked versions of various registers accessed later in the code.
if HaveSecurityExt() && CPSR.M == '10110' then SCR.NS = '0';
CPSR.M = '10111'; // Abort mode
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1213
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterMonitorMode() and
EnterHypMode() pseudocode procedures.
• A synchronous abort on a data read or write memory access. Exception entry is synchronous to the instruction
that generated the memory access.
• An asynchronous abort. The memory access that caused the abort can be any of:
— a data read or write access
— an instruction fetch
— in a VMSA memory system, a translation table access.
Exception entry occurs asynchronously, and is similar to an interrupt.
As described in Asynchronous exception masking on page B1-1183, asynchronous aborts can be masked.
When this happens, a generated asynchronous abort is not taken until it is not masked.
Note
There are no asynchronous internal aborts in ARMv7 and earlier architecture versions, so asynchronous
aborts are always asynchronous external aborts.
• A Watchpoint debug event, see Debug exception on Watchpoint debug event on page C4-2077.
Note
Data Abort exceptions generated by Watchpoint debug events can be either asynchronous or synchronous.
However, the CPSR.A bit has no effect on the taking of such an exception, regardless of whether it is
asynchronous.
By default, a Data Abort exception is taken to Abort mode, but a Data Abort exception can be taken to Monitor
mode, or to Hyp mode. For more information see Determining the mode to which the Data Abort exception is taken
on page B1-1177.
The preferred return address for a Data Abort exception is the address of the instruction that generated the aborting
memory access, or the address of the instruction following the instruction boundary at which an asynchronous Data
Abort exception was taken. This return is performed as follows:
• If returning from a PL1 mode, using the SPSR and LR values generated by the exception entry, using an
exception return instruction with a subtraction of 8. This means using:
— SPSR_abt and LR_abt if returning from Abort mode.
— SPSR_mon and LR_mon if returning from Monitor mode.
• If returning from Hyp mode, using the SPSR_hyp and ELR_hyp values generated by the exception entry,
using an ERET instruction.
For more information, see Exception return on page B1-1193.
// TakeDataAbortException()
// ========================
TakeDataAbortException()
B1-1214 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
if route_to_monitor then
// Ensure Secure state if initially in Monitor mode. This affects the Banked
// versions of various registers accessed later in the code
if CPSR.M == '10110' then SCR.NS = '0';
EnterMonitorMode(new_spsr_value, new_lr_value, vect_offset);
elsif take_to_hyp then
EnterHypMode(new_spsr_value, preferred_exceptn_return, vect_offset);
elsif route_to_hyp then
EnterHypMode(new_spsr_value, preferred_exceptn_return, 20);
else
// Handle in Abort mode. Ensure Secure state if initially in Monitor mode. This
// affects the Banked versions of various registers accessed later in the code
if HaveSecurityExt() && CPSR.M == '10110' then SCR.NS = '0';
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterMonitorMode() and
EnterHypMode() pseudocode procedures.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1215
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
If the access to a memory location generates an external abort that is taken asynchronously, it is outside the scope
of the architecture to define the effect of the store on that memory location, because this depends on the
system-specific nature of the external abort. However, in general, ARM recommends that such locations are
unchanged.
For external aborts and Watchpoints, where in principle faulting could be identified at byte or halfword granularity,
the size of a location in this definition is the size for which a memory access is single-copy atomic.
Instructions that access data memory can modify registers in the following ways:
• By loading values into one or more of the ARM core registers. The registers loaded can include the PC.
• By specifying base register writeback, in which the base register used in the address calculation has a
modified value written to it. All instructions that support base register writeback have UNPREDICTABLE results
if base register writeback is specified with the PC as the base register. Only ARM core registers other than
the PC can be modified reliably in this way.
• By changing the value of one or more coprocessor registers either directly or indirectly, for example:
— Executing an LDC instruction loads a coprocessor register directly from memory.
— Executing an STC instruction that accesses DBGDTRRXint can have a side effect of changing
DBGDSCR.RXfull. This means the STC instruction changes the value of DBGDSCR indirectly.
If the execution of such an instruction generates a synchronous Data Abort exception, the following rules determine
the values left in these registers:
• If the instruction only loads one ARM core register, the value in that register is unchanged.
• If the instruction loads more than one ARM core register, UNKNOWN values are left in destination registers
other than the PC and the base register of the instruction.
• If the instruction affects any coprocessor registers, UNKNOWN values are left in the coprocessor registers that
are affected.
• CPSR bits that are not defined as updated on exception entry retain their current value.
B1-1216 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
After taking a Data Abort exception, the state of the exclusive monitors is UNKNOWN. Therefore, ARM strongly
recommends that the abort handler performs a CLREX instruction, or a dummy STREX instruction, to clear the exclusive
monitor state.
Note
In versions of the ARM architecture before ARMv6, it is IMPLEMENTATION DEFINED whether the abort model used
is the Base Restored Abort Model or the Base Updated Abort Model. For more information, see The ARM abort
model on page D15-2588.
The conditions for generating a Virtual Abort exception mean the exception is always:
• Taken from a Non-secure PL1 or PL0 mode.
• Taken to Non-secure Abort mode.
For more information see Virtual exceptions in the Virtualization Extensions on page B1-1196.
Note
Because the Virtual Abort exception is always taken to Non-secure Abort mode, on exception entry the preferred
return address is always saved to LR_abt.
The preferred return address for a Virtual Abort exception is the address of the instruction immediately after the
instruction boundary where the exception was taken. This return is performed using the SPSR and LR_abt values
generated by the exception entry, using an exception return instruction without subtraction.
// TakeVirtualAbortException()
// ===========================
TakeVirtualAbortException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC plus 4 for Thumb or 0 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address
// of the current instruction plus 8. For an asynchronous abort, the PC and CPSR are
// considered to have already moved on to their values for the instruction following
// the instruction boundary at which the exception occurred.
new_lr_value = if CPSR.T == '1' then PC+4 else PC;
new_spsr_value = CPSR;
vect_offset = 16;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1217
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
• If SCTLR.FI == 1, IRQ exception entry is precise to an instruction boundary, except that some of the effects
of the instruction that follows that boundary might have occurred. These effects are restricted to those that
can be repeated idempotently and without breaking the rules in Single-copy atomicity on page A3-125.
Examples of such effects are:
— Changing the value of a register that the instruction writes to but does not read.
— Performing an access to Normal memory.
Note
This relaxation of the normal definition of a precise asynchronous exception permits interrupts to occur
during the execution of instructions that change register or memory values, while only requiring the
implementation to restore those register values that are needed to correctly re-execute the instruction after a
return to the preferred return address. LDM and STM are examples of such instructions.
As described in Asynchronous exception masking on page B1-1183, IRQ exceptions can be masked. When this
happens, a generated IRQ exception is not taken until it is not masked.
By default, an IRQ exception is taken to IRQ mode, but an IRQ exception can be taken to Monitor mode, or Hyp
mode. For more information, see Determining the mode to which the IRQ exception is taken on page B1-1179.
The preferred return address for an IRQ exception is the address of the instruction following the instruction
boundary at which the exception was taken. This return is performed as follows:
• If returning from a PL1 mode, using the SPSR and LR values generated by the exception entry, using an
exception return instruction with a subtraction of 4. This means using:
— SPSR_irq and LR_irq if returning from IRQ mode.
— SPSR_mon and LR_mon if returning from Monitor mode.
• If returning from Hyp mode, using the SPSR_hyp and ELR_hyp values generated by the exception entry,
using an ERET instruction.
For more information, see Exception return on page B1-1193.
B1-1218 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
// TakePhysicalIRQException()
// ==========================
TakePhysicalIRQException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address
// of the instruction boundary at which the interrupt occurred plus 4. For this
// purpose, the PC and CPSR are considered to have already moved on to their values
// for the instruction following that boundary.
new_lr_value = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
vect_offset = 24;
if route_to_monitor then
// Ensure Secure state if initially in Monitor ('10110') mode. This affects
// the Banked versions of various registers accessed later in the code.
if CPSR.M == '10110' then SCR.NS = '0';
EnterMonitorMode(new_spsr_value, new_lr_value, vect_offset);
elsif route_to_hyp then
HSR = bits(32) UNKNOWN;
preferred_exceptn_return = new_lr_value - 4;
EnterHypMode(new_spsr_value, preferred_exceptn_return, vect_offset);
else
// Handle in IRQ mode. Ensure Secure state if initially in Monitor mode. This
// affects the Banked versions of various registers accessed later in the code.
if CPSR.M == '10110' then SCR.NS = '0';
CPSR.M = '10010'; // IRQ mode
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterMonitorMode() and
EnterHypMode() pseudocode procedures.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1219
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
For more information see Virtual exceptions in the Virtualization Extensions on page B1-1196
The preferred return address for a Virtual IRQ exception is the address of the instruction immediately after the
instruction boundary where the exception was taken. This return is performed using the SPSR and LR_irq values
generated by the exception entry, using an exception return instruction with a subtraction of 4.
// TakeVirtualIRQException()
// =========================
TakeVirtualIRQException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address
// of the instruction boundary at which the interrupt occurred plus 4. For this
// purpose, the PC and CPSR are considered to have already moved on to their values
// for the instruction following that boundary.
new_lr_value = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
vect_offset = 24;
B1-1220 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
• If SCTLR.FI == 1, FIQ exception entry is precise to an instruction boundary, except that some of the effects
of the instruction that follows that boundary might have occurred. These effects are restricted to those that
can be repeated idempotently and without breaking the rules in Single-copy atomicity on page A3-125.
Examples of such effects are:
— Changing the value of a register that the instruction writes but does not read.
— Performing an access to Normal memory.
Note
This relaxation of the normal definition of a precise asynchronous exception permits interrupts to occur
during the execution of instructions that change register or memory values, while only requiring the
implementation to restore those register values that are needed to correctly re-execute the instruction after a
return to the preferred return address. LDM and STM are examples of such instructions.
As described in Asynchronous exception masking on page B1-1183, FIQ exceptions can be masked. When this
happens, a generated FIQ exception is not taken until it is not masked.
By default, an FIQ exception is taken to FIQ mode, but an FIQ exception can be taken to Monitor mode, or to Hyp
mode. For more information, see Determining the mode to which the FIQ exception is taken on page B1-1179.
The preferred return address for an FIQ exception is the address of the instruction following the instruction
boundary at which the exception was taken. This return is performed as follows:
• If returning from a PL1 mode, using the SPSR and LR values generated by the exception entry, using an
exception return instruction with a subtraction of 4. This means using:
— SPSR_fiq and LR_fiq if returning from FIQ mode.
— SPSR_mon and LR_mon if returning from Monitor mode.
• If returning from Hyp mode, using the SPSR_hyp and ELR_hyp values generated by the exception entry,
using an ERET instruction.
For more information, see Exception return on page B1-1193.
// TakePhysicalFIQException()
// ==========================
TakePhysicalFIQException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address
// of the instruction boundary at which the interrupt occurred plus 4. For this
// purpose, the PC and CPSR are considered to have already moved on to their values
// for the instruction following that boundary.
new_lr_value = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
vect_offset = 28;
if route_to_monitor then
// Ensure Secure state if initially in Monitor ('10110') mode. This affects
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1221
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
else
// Handle in FIQ mode. Ensure Secure state if initially in Monitor mode. This
// affects the Banked versions of various registers accessed later in the code.
if CPSR.M == '10110' then SCR.NS = '0';
CPSR.M = '10001'; // FIQ mode
Additional pseudocode functions for exception handling on page B1-1223 defines the EnterMonitorMode() and
EnterHypMode() pseudocode procedures.
For more information see Virtual exceptions in the Virtualization Extensions on page B1-1196.
The preferred return address for a Virtual FIQ exception is the address of the instruction immediately after the
instruction boundary where the exception was taken. This return is performed using the SPSR and LR_irq values
generated by the exception entry, using an exception return instruction with a subtraction of 4.
// TakeVirtualFIQException()
B1-1222 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.9 Exception descriptions
// =========================
TakeVirtualFIQException()
// Determine return information. SPSR is to be the current CPSR, and LR is to be the
// current PC minus 0 for Thumb or 4 for ARM, to change the PC offsets of 4 or 8
// respectively from the address of the current instruction into the required address
// of the instruction boundary at which the interrupt occurred plus 4. For this
// purpose, the PC and CPSR are considered to have already moved on to their values
// for the instruction following that boundary.
new_lr_value = if CPSR.T == '1' then PC else PC-4;
new_spsr_value = CPSR;
vect_offset = 28;
// EnterMonitorMode()
// ==================
The EnterHypMode() pseudocode function changes the processor mode to Hyp mode, with the required state changes:
// EnterHypMode()
// =============
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1223
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.9 Exception descriptions
B1-1224 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.10 Coprocessors and system control
• CP15 is called the System Control coprocessor, and is reserved for the control and configuration of the ARM
processor system, including architecture and feature identification.
The implementation of the CP14 registers is generally similar in ARMv7-A and ARMv7-R implementation.
However, CP14 provides both:
• The system control registers for ThumbEE and the Jazelle extension. These relate to the functionality
described in parts A and B of this manual.
• An interface to the debug and trace registers. These relate to the functionality described in part C of this
manual and in separate trace architecture specifications.
Therefore, part B of this manual provides separate register descriptions for VMSA and PMSA implementations.
Both descriptions include general information about CP14 register accesses, including accesses to the Debug
registers. In more detail:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1225
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.10 Coprocessors and system control
Registers that are common to VMSA and PMSA implementations are described in both Chapter B4 and Chapter B6.
Some registers are implemented differently in VMSA and PMSA implementations.
• The register descriptions in Chapter B4 System Control Registers in a VMSA implementation and Chapter B6
System Control Registers in a PMSA implementation indicate whether a register is accessible from PL0.
Note
These chapters provide all of the CP14 and CP15 register descriptions in this manual, except for the CP14
debug registers, that are described in Chapter C11 The Debug Registers.
• The descriptions of the CP14 interface in Chapter C6 Debug Register Interfaces include the permitted
accesses to the debug registers from PL0.
• The following sections summarize the permitted accesses to CP15 registers from PL0:
— For a VMSA implementation, PL0 views of the CP15 registers on page B3-1483.
— For a PMSA implementation, PL0 views of the CP15 registers on page B5-1789.
Note
The CPACR has no effect on accesses from Hyp mode.
If an implementation includes the Security Extensions, the NSACR determines which of the CP0 to CP13
coprocessors can be accessed from the Non-secure state.
If an implementation includes the Virtualization Extensions, the HCPTR provides additional controls on
Non-secure accesses to coprocessors CP0 to CP13. For accesses that are otherwise permitted by the CPACR and
NSACR settings, setting HCPTR bits to 1:
• Traps otherwise-permitted accesses from PL1 or PL0 to Hyp mode.
• Makes accesses from Hyp mode UNDEFINED.
For more information, see Trapping accesses to coprocessors on page B1-1255.
Note
• When an implementation includes either or both of the Floating-point and Advanced SIMD Extensions, the
access settings for CP10 and CP11 must be identical. If these settings are not identical the behavior of the
extensions is UNPREDICTABLE.
B1-1226 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.10 Coprocessors and system control
3. Read the Coprocessor Access Control Register again and check the access field for each coprocessor:
• If the access field value is 0b00 the coprocessor is not implemented.
• If the access field value is 0b11 the coprocessor is implemented.
4. If required, write the value from stage 1 back to the register to restore the original value.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1227
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
• The Floating-point (VFP) Extension, that adds scalar floating-point instructions to the ARM and Thumb
instruction sets.
• The Advanced SIMD Extension, that adds integer and floating-point vector instructions to the ARM and
Thumb instruction sets.
• The Advanced SIMD and Floating-point Extension registers D0 - D31 and their alternative views as S0 - S31
and Q0 - Q15.
For more information about the system registers for the Advanced SIMD and Floating-point Extensions see
Advanced SIMD and Floating-point Extension system registers on page B1-1235.
Software can interrogate the registers summarized in Advanced SIMD and Floating-point Extension feature
identification registers on page B7-1944 to discover the implemented Advanced SIMD and floating-point support.
The following subsections give more information about the Advanced SIMD and Floating-point Extensions:
• Enabling Advanced SIMD and floating-point support.
• Advanced SIMD and Floating-point Extension system registers on page B1-1235.
• Context switching with the Advanced SIMD and Floating-point Extensions on page B1-1236.
• Floating-point support code on page B1-1236.
• VFP subarchitecture support on page B1-1238.
• Any use of Advanced SIMD or floating-point features requires access to CP10 and CP11.
• Additional controls apply to the use of Advanced SIMD features, see Additional controls on Advanced SIMD
functionality on page B1-1232.
• CPACR.{cp10, cp11} control access from PL1 and PL0. The permitted values of these fields are:
0b00 No access. Any access to the Advanced SIMD and Floating-point Extension features is
UNDEFINED.
0b01 Accessible at PL1 only. Any access to the Advanced SIMD and Floating-point Extension features
from PL0 is UNDEFINED.
0b11 Accessible from PL0 and PL1. The meaning of this level of access is defined by the appropriate
coprocessor.
These fields reset to 0b00, no access.
• In an implementation that includes the Security Extensions, NSACR.{cp10, cp11} control access from
Non-secure state. The permitted values of these bits are:
0 Accessible from Secure state only. Any access to the Advanced SIMD and Floating-point
Extension features from Non-secure state is UNDEFINED.
1 Accessible from both security states, subject to any other access controls that apply. These
include:
• For all accesses from PL1 or PL0, the CPACR.{cp10, cp11} controls.
• If the implementation includes the Virtualization Extension, the HCPTR.{TCP10,
TCP11} control. This applies to accesses from PL2, PL1, and PL0.
B1-1228 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
• In an implementation that includes the Virtualization Extensions, when NSACR.{cp10, cp11} are set to 1, to
permit Non-secure accesses, HCPTR.{TCP10, TCP11} provide an additional control on those accesses. The
permitted values of these bits are:
0 Advanced SIMD and Floating-point Extension features are accessible from Non-secure state,
subject to any other access controls that apply. The CPACR.{cp10, cp11} controls:
• Apply to accesses from PL1 or PL0.
• Have no effect on accesses from PL2, Hyp mode.
1 Trap coprocessor accesses:
• Accesses from PL1 or PL0 that are permitted by other controls, including the
CPACR.{cp10, cp11} controls, generate an exception that is taken to Hyp mode.
• Any access to Advanced SIMD and Floating-point Extension features from PL2, Hyp
mode, is UNDEFINED.
When NSACR.{cp10, cp11} are set to 0, all accesses to Advanced SIMD and Floating-point Extension
features from Non-secure state are UNDEFINED.
Note
The HCPTR can also trap to Hyp mode otherwise-permitted Non-secure PL1 and PL0 accesses to Advanced
SIMD or Floating-point functionality. At reset, those traps are disabled.
In an implementation that includes at least one of the Advanced SIMD and Floating-point Extensions, access control
bits for CP10 and CP11 must be programmed with the same values, otherwise operation of the controlled Advanced
SIMD and Floating-point features is UNPREDICTABLE. This means that operation is UNPREDICTABLE:
• In an implementation that includes the Security Extensions, in Non-secure state, if the values of
NSACR.cp10 and NSACR.cp11 are different.
• In an implementation that includes the Virtualization Extensions, in Non-secure state, if the values of
HCPTR.TCP10 and HCPTR.TCP11 are different.
In addition, FPEXC.EN is an enable bit for most Advanced SIMD and Floating-point operations. When FPEXC.EN
is 0, all Advanced SIMD and Floating-point instructions are treated as UNDEFINED except for:
• A VMSR to the FPEXC or FPSID register.
• A VMRS from the FPEXC, FPSID, MVFR0, or MVFR1 register.
These instructions can be executed only at PL1 or higher.
Note
• Although FPSID is a read-only register, software can perform a VMSR to the FPSID to force Floating-point
serialization, as described in Asynchronous bounces, serialization, and Floating-point exception barriers on
page B1-1237.
• If a Floating-point implementation contains system registers additional to the FPSID, FPSCR, FPEXC,
MVFR0, and MVFR1 registers, the behavior of VMSR instructions to them and VMRS instructions from them is
SUBARCHITECTURE DEFINED.
These controls, summarized in Summary of general controls of CP10 and CP11 functionality on page B1-1230,
apply to all functionality that depends on access to CP10 and CP11. That is, they apply equally to all implemented
Advanced SIMD and floating-point functionality.
Additional controls apply to any implemented Advanced SIMD functionality, see Additional controls on Advanced
SIMD functionality on page B1-1232.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1229
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
Pseudocode details of enabling the Advanced SIMD and Floating-point Extensions on page B1-1234 gives a
pseudocode description of both sets of controls.
• UND indicates that the Advanced SIMD or floating-point access generates an Undefined Instruction
exception. For an access made from Hyp mode this exception is taken to Hyp mode, otherwise it is taken to
Secure or Non-secure Undefined mode.
• Trapped indicates that accesses generate a Hyp Trap exception, that is taken to Hyp mode.
Table B1-21 Summary of access controls for all CP10 and CP11 functionality
a. When the corresponding NSACR bit is set to 0, for Non-secure accesses the CPACR field behaves as RAZ/WI. That is, when
NSACR.cp10 is set to 0, for Non-secure accesses CPACR.cp10 ignores writes, and reads as 0b00, regardless of its actual value.
b. When the NSACR control bits are set to 0, for Non-secure accesses the HCPTR control bits behave as RAO/WI.
c. Except for VMSR to the FPEXC or FPSID register, or a VMRS from the FPEXC, FPSID, MVFR0, or MVFR1 register.
d. Except for VMSR to the FPEXC or FPSID register, or a VMRS from the FPEXC, FPSID, MVFR0, or MVFR1 register, that are Trapped.
B1-1230 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
Note
In Table B1-21 on page B1-1230:
• the behavior of Secure accesses depends only on the CPACR and FPEXC control values
• the behavior of accesses from Hyp mode depends only on the NSACR, HCPTR, and FPEXC control values.
In Table B1-21 on page B1-1230, the values for each of the registers shown in the Controls columns are:
CPACR The value of the CPACR.cp10 and CPACR.cp11 fields. These fields must be programmed to the
same value, otherwise behavior is UNPREDICTABLE. The table does not show the reserved value of
0b10.
In addition, when CP10 and CP11 functionality is otherwise enabled, if CPACR.D32DIS is set to 1,
any operation that uses registers D16-D31 of the Floating-point register file is UNDEFINED.
These controls are part of any implementation that includes at least one of the Advanced SIMD
Extension and the Floating-point Extension.
NSACR The value of the NSACR.cp10 and NSACR.cp11 bits. These bits must be programmed to the same
value, otherwise behavior is UNPREDICTABLE.
These controls are implemented only as part of the Security Extensions. For the access controls for
an implementation that does not include the Security Extensions, consider only:
• The Secure PL1 and PL0 columns.
• The rows for which NSACR is 0, and HCPTR is 0 or x.
HCPTR The value of the HCPTR.TCP10 and HCPTR.TCP11 bits. These bits must be programmed to the
same value, otherwise behavior is UNPREDICTABLE.
These controls are implemented only as part of the Virtualization Extensions. For the access controls
for an implementation that does not include the Virtualization Extensions:
• Ignore the Non-secure PL2 column.
• Consider only the rows for which HCPTR is 0 or x.
FPEXC.EN The value of FPEXC.EN. As indicated in this section, and in the table footnote, when this bit is set
to 0:
• Most Advanced SIMD and floating-point functionality is disabled.
• A limited number of register accesses are permitted at PL1 or higher.
When this bit is set to 1, Advanced SIMD and floating-point functionality is enabled, but subject to:
• The other access controls shown in the table.
• The restrictions described in PL0 access to Advanced SIMD and floating-point functionality,
and traps of PL0 functionality.
This control is part of any implementation that includes at least one of the Advanced SIMD
Extension and the Floating-point Extension.
PL0 access to Advanced SIMD and floating-point functionality, and traps of PL0 functionality
When Table B1-21 on page B1-1230 shows that PL0 access to the Advanced SIMD and floating-point functionality
is Enabled or Trapped, this applies only to the subset of functionality that is available at PL0.
In particular:
• The only Advanced SIMD and Floating-point Extension system register that is accessible at PL0 is the
FPSCR.
This means that when the CPACR, NSACR, and FPEXC controls permit Non-secure PL0 access to this Advanced
SIMD and floating point functionality, HCPTR.{TCP10, TCP11} determine whether those accesses are trapped to
Hyp mode.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1231
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
Execution at PL0 corresponds to the application level view of the extensions, as described in Advanced SIMD and
Floating-point Extensions on page A2-54.
• In an implementation that includes the Virtualization Extensions, when the CPACR and NSACR settings
permit Non-secure use of the Advanced SIMD instructions, if HCPTR.TASE is set to 1 any use of an
Advanced SIMD instruction from:
— A Non-secure PL1 or PL0 mode is trapped to Hyp mode.
— Hyp mode generates an Undefined Instruction exception that is taken to Hyp mode.
Table B1-22 references the descriptions of the registers that control this functionality, and Summary of access
controls for Advanced SIMD functionality shows these controls.
Table B1-22 Registers that control access to Advanced SIMD and floating-point functionality
Non-Secure Access Control Register NSACR - Security Extensions, therefore VMSA only
Hyp Coprocessor Trap Register HCPTR - Virtualization Extensions, therefore VMSA only
Table B1-23 on page B1-1233 summarizes the additional access controls for the use of Advanced SIMD
instructions.
• In this table, entries of UND and Enabled have the meanings defined in Summary of general controls of CP10
and CP11 functionality on page B1-1230
• The entries shown in this table must be combined with the information shown in Table B1-21 on
page B1-1230 as follows:
— If at least one table shows the access as UND then the access is UNDEFINED.
— Otherwise, if at least one table shows the access as Trapped then the access generates a Hyp Trap
exception.
— Otherwise, both tables show the access as Enabled, meaning the access is permitted.
B1-1232 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
Table B1-23 Summary of additional access controls for Advanced SIMD functionality
• The NSACR is implemented only as part of the Security Extensions. For an implementation that does not
include the Security Extensions, use of the Advanced SIMD instructions:
— Is enabled when CPACR.ASEDIS is set to 0.
— Is disabled when CPACR.ASEDIS is set to 1.
• The HCPTR is implemented only as part of the Virtualization Extensions. For an implementation that does
not include the Virtualization Extensions, when the controls shown in Table B1-21 on page B1-1230 permit
Non-secure use of the CP10 and CP11 functionality, use of the Advanced SIMD instructions from
Non-secure state:
— Is enabled when CPACR.ASEDIS and NSACR.NSASEDIS are both set to 0.
— Is disabled otherwise.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1233
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
// CheckAdvSIMDOrVFPEnabled()
// ==========================
if HaveSecurityExt() then
// Check Non-Secure Access Control Register for permission to use CP10/11.
if NSACR.cp10 != NSACR.cp11 then UNPREDICTABLE;
if !IsSecure() then
// Modify register values to the Non-secure view
if NSACR.cp10 == '0' then
cpacr_cp10 = '00';
cpacr_cp11 = '00';
if HaveVirtExt() then
hcptr_cp10 = '1';
hcptr_cp11 = '1';
if NSACR.NSASEDIS == '1' then
cpacr_asedis = '1';
if HaveVirtExt() then
hcptr_tase = '1';
B1-1234 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
return;
// CheckAdvSIMDEnabled()
// =====================
CheckAdvSIMDEnabled()
CheckAdvSIMDOrVFPEnabled(TRUE, TRUE);
// Return from CheckAdvSIMDOrVFPEnabled() occurs only if Advanced SIMD access is permitted
return;
// CheckVFPEnabled()
// =================
CheckVFPEnabled(boolean include_fpexc_check)
CheckAdvSIMDOrVFPEnabled(include_fpexc_check, FALSE);
// Return from CheckAdvSIMDOrVFPEnabled() occurs only if VFP access is permitted
return;
Register map of the Advanced SIMD and Floating-point Extension system registers
Table B1-24 shows the register map of the Advanced SIMD and Floating-point registers. Each register is 32 bits
wide. In an implementation that includes the Security Extensions, the Advanced SIMD and Floating-point registers
are common registers, see Common system control registers on page B3-1453.
a. VMSA and PMSA definitions of the register fields are identical. These columns link to the descriptions in Chapter B4 and Chapter B6.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1235
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
Note
Appendix D6 Common VFP Subarchitecture Specification includes examples of how a Floating-point
subarchitecture might define additional registers, in the SUBARCHITECTURE DEFINED register space using addresses
in the 0b1001 to 0b1111 range. Appendix D6 is not part of the ARMv7 architecture. It is included as an example of
how a Floating-point subarchitecture might be defined.
For example:
Software can access the Advanced SIMD and Floating-point Extension system registers only if the access controls
for the extensions permit the access, see Enabling Advanced SIMD and floating-point support on page B1-1228.
Note
All hardware ID information can be accessed only from PL1 or higher. This means:
B1.11.3 Context switching with the Advanced SIMD and Floating-point Extensions
In an implementation that includes one or both of the Advanced SIMD and Floating-point Extensions, if the
Floating-point registers are used by only a subset of processes, the operating system might implement lazy context
switching of the extension registers and extension system registers.
In the simplest lazy context switch implementation, the primary context switch software disables the Advanced
SIMD and Floating-point Extensions, by disabling access to coprocessors CP10 and CP11 in the Coprocessor
Access Control Register, see Enabling Advanced SIMD and floating-point support on page B1-1228. Subsequently,
when a process or thread attempts to use an Advanced SIMD or Floating-point instruction, it triggers an Undefined
Instruction exception. The operating system responds by saving and restoring the extension registers and extension
system registers. Typically, it then re-executes the Advanced SIMD or Floating-point instruction that generated the
Undefined Instruction exception.
B1-1236 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
Note
The Common VFP Subarchitecture is not part of the ARMv7 architecture specification, see VFP subarchitecture
support on page B1-1238.
If the Floating-point Extension hardware does not respond to a Floating-point instruction, the support code is
entered through the ARM Undefined Instruction vector. This software entry is called a bounce.
When an implementation includes VFPv3U or VFPv4U, the bounce mechanism also supports trapped
floating-point exceptions. Trapped floating-point exceptions, called traps, are floating-point exceptions that an
implementation passes back to application software to resolve, see Floating-point exceptions on page A2-69. The
support code must catch a trapped exception and convert it into a trap handler call.
Support code can perform other tasks, as determined by the implementation. For example, it might be used for rare
conditions, such as operations that are difficult to implement in hardware, or operations that are gate-intensive in
hardware. However, in ARMv7, ARM:
• Strongly recommends that all floating-point functionality, except for short vector support, is fully
implemented in hardware.
The division of labor between the hardware and software components of an implementation, and details of the
interface between the support code and hardware are SUBARCHITECTURE DEFINED.
Note
Asynchronous bounces were commonly used in ARMv6 implementations. For ARMv7 implementations, ARM
strongly recommends that any bounces are synchronous.
A Floating-point implementation can produce an asynchronous bounce, in which a Floating-point instruction takes
the Undefined Instruction exception because support code processing is required for an earlier Floating-point
instruction. The mechanism by which the support code determines the nature of the required processing is
SUBARCHITECTURE DEFINED. Typically, it involves:
• Using the SUBARCHITECTURE DEFINED extension system registers, see Advanced SIMD and Floating-point
Extension system registers on page B1-1235.
• Setting FPEXC.EX == 1, to indicate that the SUBARCHITECTURE DEFINED extension system registers must be
saved on a context switch.
An asynchronous bounce might not relate to the last Floating-point instruction executed before the one that
generated the Undefined Instruction exception. Another Floating-point instruction might have been issued and
retired before the asynchronous bounce occurs. This is possible only if this intervening instruction has no register
dependencies on the Floating-point instruction that requires support code processing. In addition. a subarchitecture
can proved SUBARCHITECTURE DEFINED mechanisms for handling an intervening Floating-point instruction that has
issued but not retired. The common VFP subarchitecture defined in Appendix D6 includes such mechanisms.
However, VMRS and VMSR instructions that access the FPSID, FPSCR, or FPEXC registers are serializing instructions.
This means that, before they perform any required register transfer, they ensure that any exceptional condition that
requires support code processing, from any preceding Floating-point instruction, has been detected and reflected in
the extension system registers. A VMSR instruction to the read-only FPSID register is a serializing NOP.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1237
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.11 Advanced SIMD and floating-point support
In addition:
• A VMRS or VMSR instruction that accesses the FPSCR acts as a Floating-point exception barrier. This means
that, before it performs the register transfer, it ensures that any outstanding exceptional conditions in
preceding Floating-point instructions have been detected and processed by the support code. If necessary, the
VMRS or VMSR instruction takes an asynchronous bounce to force the processing of any outstanding exceptional
conditions.
• VMRS and VMSR instructions that access the FPSID or FPEXC do not take asynchronous bounces.
In pseudocode, Floating-point serialization and the Floating-point exception barriers are described by the
SerializeVFP() and VFPExcBarrier() functions respectively.
B1-1238 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.12 Thumb Execution Environment
Chapter A9 The ThumbEE Instruction Set describes the ThumbEE instruction set.
This section describes the system level programmers’ model for ThumbEE.
From the publication of issue C.a of this manual, ARM deprecates any use of the ThumbEE instruction set.
The ThumbEE Configuration Register can be read at PL0, but can be written only at PL1 or higher, see TEECR,
ThumbEE Configuration Register, VMSA on page B4-1709 or TEECR, ThumbEE Configuration Register, PMSA on
page B6-1928.
Access to the ThumbEE Handler Base Register depends on the value held in the TEECR and the current privilege
level, see TEEHBR, ThumbEE Handler Base Register, VMSA on page B4-1710 or TEEHBR, ThumbEE Handler
Base Register, PMSA on page B6-1929.
The processor instruction set state is indicated by the CPSR.{J T} bits, see Program Status Registers (PSRs) on
page B1-1147. CPSR.{J, T} == 0b11 when the processor is in ThumbEE state.
During normal execution, not involving exception entries and returns:
• ThumbEE state can only be entered from Thumb state, using the ENTERX instruction
• exit from ThumbEE state always occurs using the LEAVEX instruction and returns execution to Thumb state.
For details of these instructions see ENTERX, LEAVEX on page A9-1116.
When an exception occurs in ThumbEE state, exception entry goes to either ARM state or Thumb state as usual,
depending on the value of SCTLR.TE. When the exception handler returns, the exception return instruction restores
CPSR.{J, T} as usual, causing a return to ThumbEE state.
In ThumbEE state, execution of the exception return instructions described in Exception return on page B1-1193 is
UNPREDICTABLE.
When an implementation that includes ThumbEE support also includes the Virtualization Extensions, accesses to
the ThumbEE registers from Non-secure PL1 and PL0 modes can be trapped to Hyp mode, see Trapping accesses
to the ThumbEE configuration registers on page B1-1254.
The IT state bits in the CPSR are always cleared on entry to a NullCheck or IndexCheck handler. For more
information, see IT block and check handlers on page A9-1114.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1239
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.13 Jazelle direct bytecode execution
For more information about entering and exiting Jazelle state see Jazelle state on page B1-1244.
Note
The existence of bit[0] as a valid address bit in the PC is visible in ARM, Thumb, or ThumbEE states only when an
exception occurs in Jazelle state and the exception return address is odd-byte aligned.
• The sequence of operations performed from the start of execution of the current bytecode instruction, up to
the point where the interrupt occurs, is idempotent. This means that the sequence can be repeated from its
start without changing the overall result of executing the bytecode instruction.
The LR value on entry to the interrupt handler must be (address of the current bytecode instruction) + 4.
In an implementation that includes the Virtualization Extensions, these options apply, also, to the point where
execution might be interrupted by a virtual IRQ or virtual FIQ:
B1-1240 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.13 Jazelle direct bytecode execution
The abort handler must be able to do this without looking at the instruction that caused the abort, and without
knowing the instruction set state it was executed in.
Note
• This assumes that the intention is to return to and retry the bytecode instruction that caused the Data Abort
exception. If the intention is instead to return to the bytecode instruction after the one that caused the abort,
then the return address must be modified by the length of the bytecode instruction that caused the abort.
To ensure the standard mechanism for handling Data Abort exceptions works correctly, a Jazelle hardware
implementation must ensure that one of the following applies at any point where a Java bytecode instruction can
generate a Data Abort exception:
• The sequence of operations performed from the start of execution of the bytecode instruction, up to the point
where the Data Abort exception is generated, is idempotent. This means that the sequence can be repeated
from its start without changing the overall result of executing the bytecode instruction.
• If the Data Abort exception is generated during execution of a bytecode instruction, corrective action is taken
either:
— Directly by the Jazelle extension hardware.
— Indirectly, by calling a SUBARCHITECTURE DEFINED handler in the EJVM.
The corrective action must re-create a situation where the bytecode instruction can be re-executed from its
start.
Note
From ARMv6, the ARM architecture does not support the Base Updated Abort Model. This removes a potential
obstacle to the first of these solutions. For information about the Base Updated Abort Model in earlier versions of
the ARM architecture see The ARM abort model on page D15-2588.
A multi-byte bytecode instruction can cross a page boundary. In this case the Prefetch Abort exception handler
cannot use LR_abt to determine which of the two pages caused the abort. Instead, in an ARMv7 implementation,
for any exception taken to a PL1 mode, the IFAR indicates the faulting address.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1241
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.13 Jazelle direct bytecode execution
JIDR and JMCR can be accessed from PL0. JOSCR is accessible only from PL1 or higher.
Note
VMSA and PMSA implementations of the Jazelle registers are identical. The registers are described both in
Chapter B4 System Control Registers in a VMSA implementation and in Chapter B6 System Control Registers in a
PMSA implementation.
In an implementation that includes the Security Extensions, the Jazelle registers are Common registers, see Common
system control registers on page B3-1453. Each register has the same access permissions in both security states. For
more information, see the register descriptions.
Note
• Normally, an EJVM never accesses the JOSCR.
• An EJVM that runs in User mode must not attempt to access the JOSCR.
The JOSCR provides a control mechanism that is independent of the subarchitecture of the Jazelle extension. An
operating system can use this mechanism to control access to the Jazelle extension.The JOSCR.CV and JOSCR.CD
are both set to 0 on reset. This ensures that, subject to some conditions, an EJVM can operate under an OS that does
not support the Jazelle extension. The main condition required to ensure an EJVM can operate under an OS that
does not support the Jazelle extension is that the operating system never swaps between two EJVM processes that
require different settings of the Jazelle configuration registers.
When the JMCR.JE bit is 0, the JOSCR has no effect on the execution of BXJ instructions. They always execute as
BX instructions, and there is no attempt to enter Jazelle state.
When the JMCR.JE bit is 1, the JOSCR.CV bit controls the operation of BXJ instructions:
If CV == 1 The Jazelle extension hardware configuration is valid and enabled. A BXJ instruction causes the
processor to enter Jazelle state in SUBARCHITECTURE DEFINED circumstances, and execute bytecode
instructions as described in Executing BXJ with Jazelle extension enabled on page A2-97.
If CV == 0 The Jazelle extension hardware configuration is not valid and therefore entry to Jazelle state is
disabled.
In all SUBARCHITECTURE DEFINED circumstances where, if CV had been 1 the BXJ instruction would
have caused the Jazelle extension hardware to enter Jazelle state, it instead:
• Enters a Configuration Invalid handler.
• Sets CV to 1.
A Configuration Invalid handler is a sequence of instructions that:
• Includes MCR instructions to write the configuration required by the EJVM.
• Ends with a BXJ instruction to re-attempt execution of the required bytecode instruction.
B1-1242 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.13 Jazelle direct bytecode execution
In ARMv7, the JOSCVR.CV bit is set to 0 on exception entry for all implementations other than a trivial
implementation of the Jazelle extension.
1. When a context switch occurs, JOSCR.CV is set to 0. This is done by the operating system or, in ARMv7, as
the result of an exception.
2. When the new process or thread performs a BXJ instruction to start executing bytecode instructions, the
Configuration Invalid handler is entered and JOSCR.CV is set to 1.
This ensures that the Jazelle extension configuration registers are set up correctly for the EJVM concerned before
any bytecode instructions are executed. It successfully handles cases where a context switch occurs during
execution of the Configuration Invalid handler.
In an implementation that includes the Virtualization Exceptions, accesses to the Jazelle system control registers
from Non-secure PL1 and PL0 modes can be trapped to Hyp mode, see Trapping accesses to Jazelle functionality
on page B1-1254.
• An OS can set JOSCR.CD to 1 and JMCR.JE to 0, to prevent all User mode access to the Jazelle extension
hardware. With these settings any use of the BXJ instruction has the same result as a BX instruction, and any
attempt to configure the hardware, including any attempt to set the JMCR.JE bit to 1, results in an Undefined
Instruction exception.
• A simple mechanism for the OS to provide User mode access to the Jazelle extension hardware, while
protecting EJVMs from conflicting use of the hardware by other processes, is:
— Set the JOSCR.CD bit to 0.
— Preserve and restore the JMCR on context switches, initializing its value to 0 for new processes.
— The JOSCR.CV bit is set to 0 on each context switch, either by the operating system or, in ARMv7, as
the result of an exception. This ensures that EJVMs reconfigure the Jazelle extension hardware to
match their requirements when necessary.
The context switch mechanism is described in Controlling entry to Jazelle state on page B1-1242.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1243
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.13 Jazelle direct bytecode execution
Initialization on page A2-99 stated that, if the EJVM is compatible with the subarchitecture, the EJVM must write
its required configuration to the JMCR and any other configuration registers. The EJVM must not omit this step on
the assumption that the JOSCR.CV bit is 0. In other words, the EJVM must not assume that JOSCR.CV is set to 0,
and that this will trigger entry to the Configuration Invalid handler before any bytecode instruction is executed by
the Jazelle extension hardware.
The Virtualization Extensions require that the Jazelle implementation is the trivial Jazelle implementation.
• Implement the JIDR with the implementer and subarchitecture fields set to zero. The register can be
implemented so that the whole register is RAZ.
• Implement the BXJ instruction to behave identically to the BX instruction in all circumstances, as required by
the fact that the JMCR.JE bit is always zero. This means that, with a trivial implementation of the Jazelle
extension, Jazelle state can never be entered normally.
Note
As described in Trapping accesses to Jazelle functionality on page B1-1254, if HSTR.TJDBX is set to 1, an
otherwise-valid execution of a BXJ instruction is trapped to Hyp mode, but execution of a BX instruction is not
trapped. In this respect only, BXJ and BX behave differently.
• Treat Jazelle state as an unimplemented instruction set state, as described in Exception return to an
unimplemented instruction set state on page B1-1196.
A trivial implementation does not have to extend the PC to 32 bits, that is, it can implement PC[0] as RAZ/WI. This
is because the only way that PC[0] is visible in ARM or Thumb state is as a result of a processor exception occurring
during Jazelle state execution, and Jazelle state execution cannot occur on a trivial implementation.
An EJVM implementation must check whether the implemented Jazelle extension is compatible with its use of the
application level registers. If the implementation is compatible, the EJVM sets JMCR.JE to 1. If the implementation
is not compatible, the EJVM sets JMCR.JE to 0, and executes without hardware acceleration.
B1-1244 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.13 Jazelle direct bytecode execution
The processor also exits Jazelle state if it takes an exception. In this case, the CPSR is copied to the Banked SPSR
for the mode to which the exception is taken, so the Banked SPSR contains J == 1 and T == 0. This means re-enters
Jazelle state on return from the exception, when the SPSR is copied back into the CPSR. With the restriction that
Jazelle state execution can modify only application level registers, this ensures that all registers are correctly
preserved and can be restored by the exception handlers. Configuration and control registers can be modified in the
exception handler itself as described in Jazelle state configuration and control on page B1-1242.
Specific considerations apply to the processor taking an exception from Jazelle state, see Exception handling in the
Jazelle extension on page B1-1240.
It is IMPLEMENTATION DEFINED whether Jazelle extension hardware contains state that is both:
• Modified during Jazelle state execution.
• Held outside the application level registers during Jazelle state execution.
• Initialize the state from one or more of the application level registers whenever Jazelle state is entered,
whether as the result of:
— The execution of a BXJ instruction.
— The processor returning from taking an exception.
• Write the state into one or more of the application level registers whenever Jazelle state is exited, whether as
a result of the processor taking an exception, or of IMPLEMENTATION DEFINED circumstances.
• Ensure that the mechanism for writing the state into application level registers on the processor taking an
exception, and initializing the state from application level registers on returning from that exception, ensures
that the state is correctly preserved and restored over the exception.
• It must not change processor mode other than by taking one of the processor exceptions described in
Exception descriptions on page B1-1204.
• It must not access Banked copies of registers other than the ones belonging to the processor mode in which
it is entered.
• It must not do anything that is illegal for an UNPREDICTABLE instruction, see UNPREDICTABLE.
As a result of these requirements, Jazelle state can be entered from PL0 without risking a breach of OS security.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1245
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
In a similar way, software executing at PL2 can route a number of exceptions to be taken to Hyp mode. Therefore,
the trapping and related mechanisms provided by the Virtualization Extensions include:
• Trapping attempted execution of certain instructions to Hyp mode, so a hypervisor can emulate the
instruction. This section describes these traps.
Note
— These controls for routing synchronous exceptions to Hyp mode are similar to the controls for the traps
described in this section, and Summary of trap controls on page B1-1260 includes these trap controls.
— In addition, a hypervisor can route interrupts and asynchronous external aborts to itself. For more
information see Asynchronous exception routing controls on page B1-1174.
• Providing aliased versions of some system control registers, see Trapping ID mechanisms on page B1-1249.
Because of the wide range of usage models for virtualization, the Virtualization Extensions provide many trapping
options, support different levels of granularity of the trapping. The following sections describe these trapping
options:
• General information about traps to the hypervisor on page B1-1247.
• Trapping ID mechanisms on page B1-1249.
• Trapping accesses to lockdown, DMA, and TCM operations on page B1-1251.
• Trapping accesses to cache maintenance operations on page B1-1252.
• Trapping accesses to TLB maintenance operations on page B1-1252.
• Trapping accesses to the Auxiliary Control Register on page B1-1252.
• Trapping accesses to the Performance Monitors Extension on page B1-1253.
• Trapping use of the SMC instruction on page B1-1253.
• Trapping use of the WFI and WFE instructions on page B1-1253.
• Trapping accesses to Jazelle functionality on page B1-1254.
• Trapping accesses to the ThumbEE configuration registers on page B1-1254.
• Trapping accesses to coprocessors on page B1-1255.
• Trapping writes to virtual memory control registers on page B1-1256.
• Generic trapping of accesses to CP15 system control registers on page B1-1256.
• Trapping CP14 accesses to debug registers on page B1-1258.
• Trapping CP14 accesses to trace registers on page B1-1259.
• Summary of trap controls on page B1-1260.
Note
Many of these sections include a Note that indicates when or why a hypervisor might use the traps described in that
section. This information is not part of the architecture specification.
These sections include descriptions of trapping Debug configuration options that can generate traps when the
processor is in Non-debug state. The Virtualization Extensions do not provide any trapping in Debug state.
B1-1246 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
A Hyp Trap exception can be generated only when all of the following apply:
• The trapped instruction is not UNPREDICTABLE in the mode in which it is executed. UNPREDICTABLE
instructions can generate a Hyp Trap exception, but the architecture does not require them to do so, see
UNPREDICTABLE.
• The trapped instruction is not UNDEFINED in the mode in which it is executed, except for the following cases
in which an UNDEFINED instruction might cause a Hyp Trap exception:
— A trapped conditional UNDEFINED instruction that, if it was not trapped, would generate an Undefined
Instruction exception, see Hyp traps on instructions that fail their condition code check on
page B1-1248.
— A PL0 mode access to IMPLEMENTATION DEFINED CP15 features in primary CP15 register c9-c11, see
Trapping accesses to lockdown, DMA, and TCM operations on page B1-1251.
— A PL0 mode access to an IMPLEMENTATION DEFINED CP15 register for which there is a generic Hyp
trap, see Generic trapping of accesses to CP15 system control registers on page B1-1256.
— When HCR.TGE is set to 1, any instruction executed in a Non-secure PL1 or PL0 mode that generates
an Undefined Instruction exception, see Undefined Instruction exception, when HCR.TGE is set to 1
on page B1-1191.
Note
• These rules mean that, for traps on system control register accesses, unless the specific trap description states
otherwise:
— If the register description in this manual describes the register as not being accessible from User mode
in Non-secure state, the Virtualization Extensions do not change this behavior. User mode accesses to
the register cannot be trapped.
— If the register description in this manual describes the register as being accessible from User mode in
Non-secure state, when accesses to the register are trapped to Hyp mode the trap applies to accesses
from both Non-secure PL1 modes and from the Non-secure PL0 mode.
• Traps to Hyp mode never apply in Secure state, regardless of the value of the SCR.NS bit.
• Although a Hyp Trap exception cannot be generated when the processor is in Hyp mode, the HCPTR restricts
coprocessor accesses in Hyp mode, as well as in the Non-secure PL1 modes. If the HCPTR settings generate
an exception when the processor is in Hyp mode, that exception is taken using the Hyp mode Undefined
Instruction vector, not the Hyp Trap vector.
Many instructions that can be trapped by a Hyp trap are UNDEFINED in User mode. For these instructions, enabling
a Hyp trap on the instruction has no effect on operation in Non-secure User mode. A small number of traps also
apply to operations in Non-secure User mode. This means they trap operations at PL0 and at PL1.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1247
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Note
The architecture requires that a Hyp trap on a conditional SMC instruction generates an exception only if the
instruction passes its condition code check, see Trapping use of the SMC instruction on page B1-1253.
This is consistent with the treatment of conditional undefined instructions, as described in Conditional execution of
undefined instructions on page B1-1208. Any implementation must be consistent in its handling of instructions that
fail their condition code check, meaning that whenever a Hyp trap it set on such an instruction it must either:
• Always generate a Hyp Trap exception.
• Always treat the instruction as a NOP.
This requirement that an implementation is consistent in its handling of instructions that fail their condition code
check also means that the IMPLEMENTATION DEFINED part of the requirements of Conditional execution of undefined
instructions on page B1-1208 must be consistent with the handling of Hyp traps on instructions that fail their
condition code check, as Table B1-25 shows:
Table B1-25 Consistent handling of instructions that fail their condition code check
Behavior of conditional UNDEFINED instruction a Hyp trap on instruction that fails its condition code check b
a. As defined in Conditional execution of undefined instructions on page B1-1208. In Non-secure PL1 and PL0 modes, applies only if no
Hyp trap is set for the instruction, otherwise see the behavior in the other column of the table.
b. For a trapped instruction executed in a Non-secure PL1 or PL0 mode.
Note
UNPREDICTABLE behavior must not perform any function that cannot be performed at the current or lower level of
privilege using instructions that are not UNPREDICTABLE. This means that setting a Hyp trap on an instruction
changes the set of instructions that might be executed in Non-secure state at PL1 or PL0. This affects, indirectly, the
permitted behavior of UNPREDICTABLE instructions.
If no instructions are configured to generate Hyp traps, then the attempted execution of an UNPREDICTABLE
instruction in a Non-secure PL1 or PL0 mode cannot generate a Hyp Trap exception.
B1-1248 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Note
The processor ID registers that can be accessed from Non-secure state can present a virtualization hole, since system
software can use them to determine information about the physical hardware that a hypervisor might want to
conceal. However, many uses of virtualization do not require the hypervisor to disguise the identity of the physical
processor.
For a small number of frequently-accessed ID registers, the Virtualization Extensions provide read/write aliases of
the registers, accessible only from Hyp mode, or from Secure state. A read of the original ID register from a
Non-secure PL1 mode actually returns the value of the read/write alias register. This register substitution is invisible
to the software reading the register.
MIDR VPIDR
MPIDR VMPIDR
A reset sets VPIDR to the MIDR value, and VMPIDR to the MPIDR value.
Reads of MIDR or MPIDR from Hyp mode or from Secure state are unchanged by the Virtualization Extensions,
and access the physical registers. This also applies to accesses from Monitor mode with SCR.NS set to 1.
Note
A hypervisor often has to virtualize one or both of the MIDR and MPIDR because:
• The MIDR provides information about the implementer, the processor name, and revision information.
• In a multiprocessor implementation, the MPIDR defines the processor position within a cluster.
The Virtualization Extensions divide the remaining ID registers into a number of groups, and provide a bit for each
group in the HCR, to control trapping of accesses to that group of registers. Setting one of these HCR bits to 1 means
that any attempt to read a register in that group or, for the CSSELR register, attempts to write that register if it is in
that group from a Non-secure mode other than Hyp mode generates a Hyp Trap exception, unless the register
description indicates that the attempted access is UNDEFINED. This trap has no effect on writes to these registers other
than the case of the CSSELR.
Note
Most but not all of the ID registers are RO registers, and write accesses to these registers behave as described in
Read-only and write-only register encodings on page B3-1445. Each register description identifies whether the
register is RO.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1249
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Table B1-27 shows the HCR trap bits, and references the subsections that define the registers in each group. Each
group description also indicates how the trap is reported to the exception handler.
Note
With MIDR and MPIDR, these registers provide the coarse-grained identification mechanisms that software is
likely to access.
The registers that are in ID group 0 for Hyp traps are the FPSID register and the JIDR.
When an exception is taken because HCR.TID0 is set to 1, the HSR reports the exception:
• Using EC value 0x05, trapped CP14 access, for a read of JIDR.
• Using EC value 0x08, trapped CP10 access, for a read of FPSID.
If the HCPTR traps accesses to CP10 and CP11, then for a read of FPSID that trap has priority over the ID group 0
trap. For more information, see Trapping accesses to coprocessors on page B1-1255.
For more information about the exception reporting, see Use of the HSR on page B3-1421.
Note
In ARMv7, these registers often provide coarse-grained identification mechanisms for implementation-specific
features.
The registers that are in ID group 1 for Hyp traps are the TCMTR, TLBTR, REVIDR, and AIDR.
When an exception is taken because HCR.TID1 is set to 1, the HSR reports the exception as a trapped CP15 access,
using the EC value 0x03, see Use of the HSR on page B3-1421.
Note
These are the registers that describe and control the cache implementation.
The registers that are in ID group 2 for Hyp traps are the CTR, CCSIDR, CLIDR, and CSSELR.
When an exception is taken because HCR.TID2 is set to 1, the HSR reports the exception as a trapped CP15 access,
using the EC value 0x03, see Use of the HSR on page B3-1421.
B1-1250 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Note
These are the CPUID registers, that provide detailed information about the features of the processor
implementation. In many implementations of virtualization the hypervisor will not trap accesses to registers in this
group. The architecture only requires this trap to apply to the registers listed in this section. There is no requirement
for the trap to apply to the registers that Chapter B7 The CPUID Identification Scheme defines as reserved.
The registers that are in ID group 3 for Hyp traps are the ID_PFR0, ID_PFR1, ID_DFR0, ID_AFR0, ID_MMFR0,
ID_MMFR1, ID_MMFR2, ID_MMFR3, ID_ISAR0, ID_ISAR1, ID_ISAR2, ID_ISAR3, ID_ISAR4, ID_ISAR5,
MVFR0, and MVFR1.
When an exception is taken because HCR.TID3 is set to 1, the HSR reports the exception:
• Using EC value 0x08, trapped CP10 access, for a read of MVFR0 or MVFR1.
• Using EC value 0x03, trapped CP15 access, for a read of any other register in the group.
If the HCPTR traps accesses to CP10 and CP11, then for reads of MVFR0 and MVFR1, that trap has priority over
the ID group 3 trap. For more information, see Trapping accesses to coprocessors on page B1-1255.
For more information about the exception reporting, see Use of the HSR on page B3-1421.
• CRn==c9, opc1=={0-7}, CRm=={c0-c2, c5-c8}, opc2=={0-7}, see Cache and TCM lockdown registers,
VMSA on page B4-1745.
• CRn==c10, opc1=={0-7}, CRm=={c0, c1, c4, c8}, opc2=={0-7}, see VMSA CP15 c10 register summary,
memory remapping and TLB control registers on page B3-1473.
• CRn==c11, opc1=={0-7}, CRm=={c0-c8, c15}, opc2=={0-7}, see VMSA CP15 c11 register summary,
reserved for TCM DMA registers on page B3-1473.
• Any attempt to use an MCR or MRC instruction with one of these encodings from a Non-secure PL1 mode
generates a Hyp Trap exception.
• On an attempt to use an MCR or MRC instruction with one of these encodings from Non-secure PL0 mode, it is
IMPLEMENTATION DEFINED which of the following occurs:
• Any lockdown fault in the memory system caused by the use of these operations in Non-secure state
generates a Data Abort exception that is taken to Hyp mode.
An implementation can include IMPLEMENTATION DEFINED registers that provide additional controls, to give
finer-grained control of the trapping of IMPLEMENTATION DEFINED features.
When an exception is taken because HCR.TIDCP is set to 1, the HSR reports the exception as a trapped CP15
access, using the EC value 0x03, see Use of the HSR on page B3-1421.
Note
• ARM expects the trapping of Non-secure User mode access to these functions to Hyp mode to be unusual,
and used only when the hypervisor is virtualizing User mode operation. ARM strongly recommends that,
unless the hypervisor must virtualize User mode operation, a Non-secure User mode access to any of these
functions generates an Undefined Instruction exception, as it would if the implementation did not include the
Virtualization Extensions. The processor then takes this exception to Non-secure Undefined mode.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1251
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
• The trapping of all attempted accesses to these registers from Non-secure PL1 modes overrides the general
behavior described in Hyp traps on instructions that are UNDEFINED on page B1-1248.
Note
Virtualizing a uniprocessor system within an MP system, permitting a virtual machine to move between different
physical processors, makes cache maintenance by set/way difficult. This is because a set/way operation might be
interrupted part way through its operation, and therefore the hypervisor must reproduce the effect of the
maintenance on both physical processors
Table B1-28 shows the HCR trap bits that trap cache maintenance operations to the hypervisor. When one of these
bits is set to 1, any attempt to access one of the corresponding CP15 c7 operations from a Non-secure PL1 mode
generates a Hyp Trap exception.
For any of these traps, when the exception is taken, the HSR reports the exception as a trapped CP15 access, using
the EC value 0x03, see Use of the HSR on page B3-1421.
For more information about these operations, see Cache and branch predictor maintenance operations, VMSA on
page B4-1735.
When an exception is taken because HCR.TTLB is set to 1, the HSR reports the exception as a trapped CP15 access,
using the EC value 0x03, see Use of the HSR on page B3-1421.
For more information about these operations, see TLB maintenance operations, not in Hyp mode on page B4-1738.
Note
The ACTLR is an IMPLEMENTATION DEFINED register that might implement global control bits for the processor.
An attempt by a Guest OS to access the ACTLR is a potential virtualization problem. Trapping these accesses to the
hypervisor means the hypervisor can react, typically by emulating the required function or signaling a virtualization
error.
Setting HCR.TAC to 1 means that any attempt to access the ACTLR from Non-secure PL1 generates a Hyp Trap
exception.
When an exception is taken because HCR.TAC is set to 1, the HSR reports the exception as a trapped CP15 access,
using the EC value 0x03, see Use of the HSR on page B3-1421.
B1-1252 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Note
A hypervisor might assign Performance Monitors functionality to a particular Guest OS, or might virtualize
performance monitoring. The Virtualization Extensions provide a trap bit that, when set to 1, traps all CP15 accesses
to the Performance Monitors to the Hyp Trap exception. A hypervisor might use this as part of a lazy context switch
that assigns the Performance Monitors to a particular Guest OS, or might use it as part of a virtualization approach.
A second trap bit traps accesses to the PMCR. The hypervisor can use this in emulating the Performance Monitors
identification bits.
The Performance Monitors Extension is an OPTIONAL extension to an ARMv7 implementation. The processor
accesses the Performance Monitors Extension registers through the CP15 c9 registers with opc1 == {0-7},
CRm == {c12-c15}, opc2 == {0-7}.
• Setting HDCR.TPM to 1 traps accesses to the Performance Monitors Extension registers to Hyp mode. When
this bit is set to 1, any attempt to access these registers from a Non-secure PL1 or PL0 mode generates a Hyp
Trap exception, unless the register description in Performance Monitors registers on page C12-2314
indicates that the attempted access is UNDEFINED.
• Setting HDCR.TPMCR to 1 traps CP15 accesses to the PMCR to Hyp mode. The conditions for this trap are
identical to those for the trap controlled by HDCR.TPM.
For either of these traps, when the exception is taken, the HSR reports the exception as a trapped CP15 access, using
the EC value 0x03, see Use of the HSR on page B3-1421.
Note
Typically, a hypervisor determines whether a Guest OS can access Secure state directly. If the hypervisor does not
permit a particular Guest OS to access Secure state directly, and that Guest OS attempts to change to Secure state,
then the hypervisor must either report a virtualization error or emulate the required Secure state operation. To
support this, the HCR includes a bit that traps use of the SMC instruction to the Hyp Trap exception.
When HCR.TSC is set to 1, an attempt to execute an SMC instruction from a Non-secure PL1 mode generates a Hyp
Trap exception, regardless of the value of SCR.SCD.
Note
When HCR.TSC is set to 0, SCR.SCD controls whether SMC instructions can be executed from Non-secure state:
• When SCR.SCD is set to 0, the SMC instruction executes normally in Non-secure state.
• When SCR.SCD is set to 1, the SMC instruction is UNDEFINED in Non-secure state.
The HCR.TSC trap mechanism traps the attempted execution of a conditional SMC instruction only if the instruction
passes its condition code check.
When an exception is taken because HCR.TSC is set to 1, the HSR reports the exception as a trapped SMC instruction,
using the EC value 0x13, see Use of the HSR on page B3-1421.
Note
An operating system can use the WFI mechanism to signal to the processor that it can suspend operation until it
receives an interrupt. In a virtualized system, the hypervisor might use this signal as an indication that it can switch
to another Guest OS. Therefore, the HCR includes a bit that traps attempted execution of a WFI instruction to the
Hyp Trap exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1253
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Software can use the WFE mechanism to signal to the processor that it can suspend execution during polling of a
variable, such as a spinlock. In a virtualized system, WFE might indicate an opportunity for the hypervisor to
reschedule. However, WFE generally requires a shorter wait than WFI, and therefore there might be situations
where rescheduling on WFE is not appropriate.
For this reason, the HCR includes separate bits for trapping WFI and WFE to the Hyp Trap exception.
When HCR.TWI is set to 1, and the processor is in a Non-secure mode other than Hyp mode, execution of a WFI
instruction generates a Hyp Trap exception if, ignoring the value of the HCR.TWI bit, conditions permit the
processor to suspend execution. For more information about when a WFI instruction can cause the processor to
suspend execution, see Wait For Interrupt on page B1-1202.
When HCR.TWE is set to 1, and the processor is in a Non-secure mode other than Hyp mode, execution of a WFE
instruction generates a Hyp Trap exception if, ignoring the value of the HCR.TWE bit, conditions permit the
processor to suspend execution. For more information about when a WFE instruction can cause the processor to
suspend execution, see Wait For Event and Send Event on page B1-1199.
For either of these traps, when the exception is taken, the HSR reports the exception as a trapped WFI or WFE
instruction, using the EC value 0x01, see Use of the HSR on page B3-1421.
• Any access to the JOSCR, JMCR, or a Jazelle SUBARCHITECTURE DEFINED configuration register, that this
reference manual or the Jazelle subarchitecture description does not describe as UNDEFINED.
Note
• An implementation that includes the Virtualization Extensions must include only a trivial Jazelle
implementation. These traps apply to the trivial Jazelle implementation.
• The HSTR.TJDBX trap does not trap accesses to the JIDR. See, instead, ID group 0, Primary device
identification registers on page B1-1250.
When an exception is taken because HSTR.TJDBX is set to 1, the HSR reports the exception as:
• A trapped CP14 access, using EC value 0x05, for an access to a Jazelle register.
• A trapped BXJ instruction, using EC value 0x0A, for execution of a BXJ instruction.
For more information about the exception reporting, see Use of the HSR on page B3-1421.
When an exception is taken because HSTR.TTEE is set to 1, the HSR reports the exception as a trapped CP14
access, using the EC value 0x05, see Use of the HSR on page B3-1421.
B1-1254 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Note
• A hypervisor might use the coprocessor access trapping mechanism as part of an implementation of lazy
switching of Guest OSs.
• One function of the CPACR is as an ID register that identifies what coprocessor functionality is implemented.
A hypervisor can trap CPACR accesses, to emulate this ID mechanism.
The HCPTR provides bits that trap coprocessor operations, to coprocessors other than CP14 and CP15, to Hyp
mode. The traps controlled by the HCPTR apply regardless of whether the processor is in Debug state.
As described in Access controls on CP0 to CP13 on page B1-1226, the HCPTR traps are secondary to the controls
provided by the CPACR and NSACR. Only if those controls permit a Non-secure access to a coprocessor can the
HCPTR setting trap that access to Hyp mode.
If the NSACR.cpn control bit is set to 1, prohibiting Non-secure accesses to coprocessor n, then:
• Non-secure accesses to the coprocessor behave as if HCPTR.TCPn is set to1, regardless of the value of that
bit.
• Non-secure writes to the corresponding HCPTR.TCPn bit are ignored.
• Non-secure reads of HCPTR.TCPn return 1, regardless of the actual value of that bit.
In addition, for the HCPTR traps on coprocessor accesses, and on the use of Advanced SIMD functionality, if a trap
bit is set to 1, an attempt to access the trapped functionality from Hyp mode generates an Undefined Instruction
exception, that is taken to Hyp mode.
The following subsections give more information about the HCPTR traps:
• Trapping of Advanced SIMD functionality.
• General trapping of coprocessor accesses on page B1-1256.
• Trapping CPACR accesses on page B1-1256.
Trapping CP14 accesses to trace registers on page B1-1259 describes an additional HCPTR trap.
• From a Non-secure mode other than Hyp mode generates a Hyp Trap exception.
Note
If the CPACR.ASEDIS is set to 1, the CPACR.ASEDIS setting takes priority. This means any execution of
an Advanced SIMD instruction by Non-secure software executing at PL1 or PL0 generates an Undefined
Instruction exception, taken to Non-secure Undefined mode, and is not trapped to Hyp mode.
• From Hyp mode generates an Undefined Instruction exception, taken to Hyp mode, with the HSR holding a
syndrome for the instruction.
Note
When HCPTR.TASE is set to 0, if the NSACR settings permit Non-secure use of the Advanced SIMD
functionality then Hyp mode can access that functionality, regardless of any settings in the CPACR.
When an exception is taken because HCPTR.TASE is set to 1, the HSR reports the exception as a HCPTR-trapped
coprocessor access, using the EC value 0x07, see Use of the HSR on page B3-1421.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1255
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
• From a Non-secure mode other than Hyp mode, generates a Hyp Trap exception.
Note
If the CPACR.cpn field does not permit the PL1 or PL0 access, then the CPACR.cpn setting takes priority.
This means the access generates an Undefined Instruction exception, taken to Non-secure Undefined mode,
and is not trapped to Hyp mode.
• From Hyp mode, generates an Undefined Instruction exception, taken to Hyp mode, with the HSR holding a
syndrome for the instruction.
Note
When HCPTR.TCPn is set to 0, if the NSACR settings permit Non-secure use of coprocessor CPn then Hyp
mode can access that coprocessor, regardless of any settings in the CPACR.
When an exception is taken because an HCPTR.TCPn bit is set to 1, the HSR reports the exception as a
HCPTR-trapped coprocessor access, using the EC value 0x07, see Use of the HSR on page B3-1421.
When an exception is taken because HCPTR.TCPAC is set to 1, the HSR reports the exception as a trapped CP15
access, using the EC value 0x03, see Use of the HSR on page B3-1421.
Note
The Virtualization Extensions provide a second stage of address translation, that a hypervisor can use to remap the
address map defined by a Guest OS. In addition, a hypervisor can trap attempts by the Guest OS to write to the
registers that control the Non-secure memory system. A hypervisor might use this trap as part of its virtualization
of memory management.
Setting HCR.TVM to 1 means that any attempt, to write to a Non-secure memory control register from a Non-secure
PL1 or PL0 mode, that this reference manual does not describe as UNDEFINED, generates a Hyp Trap exception. This
trap applies to accesses to the SCTLR, TTBR0, TTBR1, TTBCR, DACR, DFSR, IFSR, DFAR, IFAR, AxFSRs,
PRRR, NMRR, MAIRs, and the CONTEXTIDR.
When an exception is taken because HCR.TVM is set to 1, the HSR reports the exception:
• As a trapped MCR or MRC CP15 access, using the EC value 0x03, if the access is to a 32-bit register.
• As a trapped MCRR or MRRC CP15 access, using the EC value 0x04, if the access is to a 64-bit register.
For more information about the exception reporting, see Use of the HSR on page B3-1421.
Note
• Many of the hypervisor traps described in the section Traps to the hypervisor on page B1-1246 trap specific
CP15 system control register operations to Hyp mode. However, because of the large number of possible
usage models for virtualization, the traps on specific functions might not meet all possible requirements.
Therefore, the Virtualization Extensions also provide a set of generic traps for trapping CP15 accesses to Hyp
mode, as described in this subsection.
B1-1256 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
• ARM expects that trapping of Non-secure User mode accesses to CP15 to Hyp mode will be unusual, and
used only when the hypervisor must virtualize User mode operation. ARM recommends that, whenever
possible, Non-secure User mode accesses to CP15 behave as they would if the processor did not implement
the Virtualization Extensions, generating an Undefined Instruction exception taken to Non-secure Undefined
mode if the architecture does not support the User mode access.
The HSTR provides trap bits {T0-T3, T5-T13, T15}, for trapping accesses to each implemented primary CP15
register, {c0-c3, c5-c13, c15}. When a trap bit is set to 0, it has no effect on accesses to the CP15 registers. When a
trap bit is set to 1, the trap applies as follows:
• In MCR and MRC instructions, CRn specifies the primary CP15 register. The trap applies if the value of CRn
corresponds to the trapped primary CP15 register.
• In MCRR and MRRC instructions, CRm specifies the primary CP15 register. The trap applies if the value of CRm
corresponds to the trapped primary CP15 register.
• Any MCR, MRC, MCRR, or MRRC access from a Non-secure PL1 mode, generates a Hyp Trap exception.
• Any MCR, MRC, MCRR, or MRRC access from Non-secure User mode:
— Generates a Hyp Trap exception if the access would not be UNDEFINED if the corresponding trap bit
was set to 0.
— Otherwise, generates an Undefined Instruction exception, taken to Non-secure Undefined mode.
If it is IMPLEMENTATION DEFINED whether, when the corresponding trap bit is set to 0, an access from
Non-secure User mode is UNDEFINED, then, when the corresponding trap bit is set to 1, it is IMPLEMENTATION
DEFINED whether an access from Non-secure User mode generates:
— A Hyp trap exception.
— An Undefined Instruction exception, taken to Non-secure Undefined mode.
This behavior is an exception to the general trapping behavior described in Hyp traps on instructions that are
UNDEFINED on page B1-1248.
Note
• The definition of this trap means that, when HSTR.Tx is set to 1, the trap applies to accesses from Non-secure
PL1 or PL0 modes:
— Using an MCR or MRC instruction with CRn set to x.
— Using an MCRR or MRRC instruction with CRm set to x.
• HSTR bit[14] is reserved, UNK/SBZP regardless of whether the implementation includes the Generic Timer,
that has its control registers in CP15 c14. The HSTR does not provide a trap on accesses to the Generic Timer
CP15 registers.
• Any 32-bit CP15 access from a Non-secure PL1 mode, using an MRC or MCR instruction with CRn set to c7, is
trapped to Hyp mode.
• Any 64-bit CP15 access from a Non-secure PL1 mode, using an MRRC or MCRR instructions with CRm set to c7,
is trapped to Hyp mode.
When an exception is taken because an HSTR.Tn bit is set to 1, the HSR reports the exception:
• As a trapped MCR or MRC CP15 access, using the EC value 0x03, if the access uses an MCR or MRC instruction.
• As a trapped MCRR or MRRC CP15 access, using the EC value 0x04, if the access uses an MCRR or MRRC instruction.
For more information about the exception reporting, see Use of the HSR on page B3-1421.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1257
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
CP14 register accesses can have side-effects. When a CP14 register access is trapped to Hyp mode, no side-effects
occur before the exception is taken, see Traps of register access instructions on page B1-1249.
For more information about the reporting of the exceptions see Use of the HSR on page B3-1421.
The following sections summarize the HDCR control bits, the associated debug registers, and the HSR reporting of
the Hyp Trap exception:
• Trapping CP14 accesses to Debug ROM registers.
• Trapping CP14 accesses to OS-related debug registers.
• Trapping general CP14 accesses to debug registers.
• Permitted combinations of HDCR.{TDRA, TDOSA, TDA, TDE} bits on page B1-1259.
The HSR reports the exception as a trapped MCR or MRC access to CP14, using the EC value 0x05.
• Any IMPLEMENTATION DEFINED register with similar functionality, that the implementation specifies is
trapped by HDCR.TDOSA.
Depending on the instruction used for the attempted register access, the HSR reports the exception:
• For an access to a 32-bit CP14 register, as a trapped MCR or MRC access to CP14, using the EC value 0x05.
• For an access to a 64-bit register, as a trapped MRRC access to CP14, using the EC value 0x0C.
• Any access that this reference manual describes as UNPREDICTABLE or as causing an Undefined Instruction
exception. Accesses described as UNPREDICTABLE can generate a Hyp Trap exception, but the architecture
does not require them to do so, see UNPREDICTABLE.
• Any access to DBGDRAR or DBGDSAR. For more information about trapping accesses to these registers
see Trapping CP14 accesses to Debug ROM registers.
B1-1258 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
• Any access to an OS-related debug register. For a list of these registers, and more information about trapping
accesses to them, see Trapping CP14 accesses to OS-related debug registers on page B1-1258.
Accesses trapped to Hyp mode by setting HDCR.TDA to 1 include STC accesses to DBGDTRRXint, and LDC
accesses to DBGDTRTXint.
When HDCR.TDA is set to 1, both of HDCR.{TDRA, TDOSA} must be set to 1, otherwise behavior is
UNPREDICTABLE.
If HDCR.TDE is set to 1, HDCR.TDA must be set to 1, otherwise behavior is UNPREDICTABLE. For more
information about HDCR.TDE, see Routing Debug exceptions to Hyp mode on page B1-1193.
Depending on the instruction used for the attempted register access, the HSR reports the exception:
• As a trapped MCR or MRC access to CP14, using the EC value 0x05.
• As a trapped LDC or STC access to CP14, using the EC value 0x06.
• If made from a Non-secure PL1 or PL0 mode, generates a Hyp Trap exception.
• If made from Hyp mode, generates an Undefined Instruction exception, taken to Hyp mode, with the HSR
holding a syndrome for the instruction.
Note
Accesses described as UNPREDICTABLE can generate a Hyp Trap or Undefined Instruction exception, but the
architecture does not require them to do so. See UNPREDICTABLE.
CP14 register accesses can have side-effects. When a CP14 register access is trapped to Hyp mode, or generates an
Undefined Instruction exception, because of the value of HCPTR.TTA, no side-effects occur before the exception
is taken, see Traps of register access instructions on page B1-1249.
When the processor is in Debug state, these register accesses do not generate Hyp Trap exceptions, regardless of the
value of HCPTR.TTA.
Trapping accesses to coprocessors on page B1-1255 describes other traps controlled by HCPTR.
When a Hyp Trap exception is generated because HCPTR.TTA is set to 1, the HSR reports the exception as a
trapped MCR or MRC access to CP14, using the EC value 0x05. For more information see Use of the HSR on
page B3-1421.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B1-1259
ID040418 Non-Confidential
B1 System Level Programmers’ Model
B1.14 Traps to the hypervisor
Trapping accesses to lockdown, DMA, and TCM operations on page B1-1251 HCR.TIDCP
Trapping accesses to cache maintenance operations on page B1-1252 HCR.{TSW, TPC, TPU}
Trapping accesses to the Performance Monitors Extension on page B1-1253 HDCR.{TPM, TPMCR}
Trapping use of the WFI and WFE instructions on page B1-1253 HCR.{TWI, TWE}
Generic trapping of accesses to CP15 system control registers on page B1-1256 HSTR.{T0-T3, T5-T13, T15}
B1-1260 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter B2
Common Memory System Architecture Features
This chapter provides a system level view of the general features of the memory system. It contains the following
sections:
• About the memory system architecture on page B2-1262.
• Caches and branch predictors on page B2-1264.
• IMPLEMENTATION DEFINED memory system features on page B2-1290.
• Pseudocode details of general memory system operations on page B2-1291.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1261
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.1 About the memory system architecture
• ARMv7-A, the A profile, requires the inclusion of a Virtual Memory System Architecture (VMSA), as
described in Chapter B3 Virtual Memory System Architecture (VMSA).
• ARMv7-R, the R profile, requires the inclusion of a Protected Memory System Architecture (PMSA), as
described in Chapter B5 Protected Memory System Architecture (PMSA).
Both of these memory system architectures provide mechanisms to split memory into different regions. Each region
has specific memory types and attributes. The two memory system architectures have different capabilities and
programmers’ models.
The memory system architecture model required by ARMv7-M, the M profile, is outside the scope of this manual.
It is described in the ARMv7-M Architecture Reference Manual.
• In a VMSA implementation, the translation tables define the virtual memory regions, and the attributes for
each region.
Note
Depending on its translation regime, an access is subject to one or two stages of translation. For an access
that requires two stages of translation, the attributes from each stage of translation are combined to obtain the
final region attribute. About the VMSA on page B3-1306 defines the translation regimes.
• In a PMSA implementation the attributes are part of each MPU memory region definition, see Memory region
attributes on page B5-1754.
The exception to this is an ARMv7-A implementation that includes the Large Physical Address Extension and is
using the Long-descriptor translation table format. In this case, the translation table entry for any Cacheable region
assigns that region both a Read-Allocate and a Write-Allocate hint. Each hint is either Allocate or Do not allocate.
For more information, see Long-descriptor format memory region attributes on page B3-1368.
B2-1262 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.1 About the memory system architecture
Note
A Cacheable region with both no Read-Allocate and no Write-Allocate hints is not the same as a Non-cacheable
region. A Non-cacheable region has coherency guarantees for observers outside its Shareability domains, that do
not apply for a region that is Cacheable, no Read-Allocate, no Write-Allocate.
The architecture does not require an implementation to make any use of cache allocation hints. This means an
implementation might not make any distinction between memory regions with attributes that differ only in their
cache allocation hint.
Note
Before ARMv7, the architecturally-defined cache control mechanism covers only a single level of cache, and any
support for other levels of cache is IMPLEMENTATION DEFINED.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1263
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Note
• Branch predictors typically use a form of cache to hold branch target data. Therefore, they are included in
this section.
• The following sections describe the cache identification and control mechanisms in previous versions of the
ARM architecture:
— Cache support on page D12-2504, for ARMv6.
— Cache support on page D15-2590, for the ARMv4 and ARMv5 architectures.
• A single Cache Size Selection Register selects the cache level and cache type of the current Cache Size
Identification Register, see:
— CSSELR, Cache Size Selection Register, VMSA on page B4-1551, for a VMSA implementation.
— CSSELR, Cache Size Selection Register, PMSA on page B6-1826, for a PMSA implementation.
• For each implemented cache, across all the levels of caching, a Cache Size Identification Register defines:
— Whether the cache supports Write-Through, Write-Back, Read-Allocate and Write-Allocate.
— The number of sets, associativity, and line length of the cache.
B2-1264 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
1. Read the Cache Type Register to find the indexing and tagging policy used for the Level 1 instruction cache.
This register also provides the size of the smallest cache lines used for the instruction caches, and for the data
and unified caches. These values are used in cache maintenance operations.
2. Read the Cache Level ID Register to find what caches are implemented. The register includes seven Cache
type fields, for cache levels 1 to 7. Scanning these fields, starting from Level 1, identifies the instruction, data
or unified caches implemented at each level. This scan ends when it reaches a level at which no caches are
defined. The Cache Level ID Register also provides the Level of Unification (LoU) and the Level of
Coherence (LoC) for the cache implementation.
Note
In ARMv6, only the Level 1 caches are architecturally defined, and the Cache Type Register holds details of the
caches. For more information, see Cache support on page D12-2504.
Given this range of factors, and the large variety of cache systems that might be implemented, the architecture
cannot guarantee whether:
• A memory location present in the cache remains in the cache.
• A memory location not present in the cache is brought into the cache.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1265
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
• The architecture has a concept of an entry locked down in the cache. How lockdown is achieved is
IMPLEMENTATION DEFINED, and lockdown might not be supported by:
— A particular implementation.
— Some memory attributes.
• An unlocked entry in the cache cannot be relied upon to remain in the cache. If an unlocked entry does remain
in the cache, it cannot be relied upon to remain incoherent with the rest of memory. In other words, software
must not assume that an unlocked item that remains in the cache remains dirty.
• A locked entry in the cache can be relied upon to remain in the cache. A locked entry in the cache cannot be
relied upon to remain incoherent with the rest of memory, that is, it cannot be relied on to remain dirty.
Note
For more information, see The interaction of cache lockdown with cache maintenance operations on
page B2-1286.
• There is no mechanism that can guarantee that the memory location cannot be allocated to an enabled cache
at any time if a memory location both:
— Has permissions that mean it can be accessed, either by reads or by writes, for the translation scheme
at either the current level of privilege or at a higher level of privilege.
— Is marked as Cacheable for that translation regime.
Any application must assume that any memory location with such access permissions and cacheability
attributes can be allocated to any enabled cache at any time.
• If the cache is disabled, it is guaranteed that no new allocation of memory locations into the cache occurs.
• If the cache is enabled, it is guaranteed that no memory location that does not have a Cacheable attribute is
allocated into the cache.
• If the cache is enabled, it is guaranteed that no memory location is allocated to the cache if the access
permissions for that location are such that the location cannot be accessed by reads and cannot be accessed
by writes in both:
— The translation regime at the current level of privilege.
— The translation regime at a higher level of privilege.
• For data accesses, any memory location that is marked as Normal Shareable is guaranteed to be coherent with
all masters in that shareability domain.
• Any memory location is not guaranteed to remain incoherent with the rest of memory.
• The eviction of a cache entry from a cache level can overwrite memory that has been written by another
observer only if the entry contains a memory location that has been written to by an observer in the
shareability domain of that memory location. The maximum size of the memory that can be overwritten is
called the Cache Write-back Granule. In some implementations the CTR identifies the Cache Write-back
Granule, see:
— CTR, Cache Type Register, VMSA on page B4-1552 for a VMSA implementation.
— CTR, Cache Type Register, PMSA on page B6-1827 for a PMSA implementation.
• The allocation of a memory location into a cache cannot cause the most recent value of that memory location
to become invisible to an observer, if it had previously been visible to that observer.
For the purpose of these principles, a cache entry covers at least 16 bytes and no more than 2KB of contiguous
address space, aligned to its size.
In ARMv7, in the following situations it is UNPREDICTABLE whether the location is returned from cache or from
memory:
• The location is not marked as Cacheable but is contained in the cache. This situation can occur if a location
is marked as Non-cacheable after it has been allocated into the cache.
B2-1266 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
• The location is marked as Cacheable and might be contained in the cache, but the cache is disabled.
• An implementation can require the use of a specific cache initialization routine to invalidate its storage array
before it is enabled. The exact form of any required initialization routine is IMPLEMENTATION DEFINED, and
the routine must be documented clearly as part of the documentation of the device.
• It is IMPLEMENTATION DEFINED whether an access can generate a cache hit when the cache is disabled. If an
implementation permits cache hits when the cache is disabled the cache initialization routine must:
— Provide a mechanism to ensure the correct initialization of the caches.
— Be documented clearly as part of the documentation of the device.
In particular, if an implementation permits cache hits when the cache is disabled and the cache contents are
not invalidated at reset, the initialization routine must avoid any possibility of running from an uninitialized
cache. It is acceptable for an initialization routine to require a fixed instruction sequence to be placed in a
restricted range of memory.
• ARM recommends that whenever an invalidation routine is required, it is based on the ARMv7 cache
maintenance operations.
When it is enabled, the state of a cache is UNPREDICTABLE if the appropriate initialization routine has not been
performed.
Note
Before ARMv7, caches are invalidated by the assertion of reset, see Cache behavior at reset on page D12-2505.
Behavior of Preload Data (PLD, PLDW) and Preload Instruction (PLI) with caches
The PLD and PLI instructions provide Preload Data and Preload Instruction operations. These instructions are
implemented in the ARM and Thumb instruction sets. The Multiprocessing Extensions add the PLDW instruction.
These instructions are memory system hints, and the effect of each instruction is IMPLEMENTATION DEFINED, see
Preloading caches on page A3-155.
Because they are hints to the memory system, the operation of a PLD, PLDW, or PLI instruction does not cause a
synchronous abort to occur. However, a memory operation performed as a result of one of these memory system
hints might trigger an asynchronous event, so influencing the execution of the processor. Examples of the
asynchronous events that might be triggered are asynchronous aborts and interrupts.
Any location that can be allocated into a cache at any time as described in the General behavior of the caches on
page B2-1265 can be allocated as a result of a PLD, PLDW, or PLI instructions.
A memory location can be accessed as a result of a PLD, PLDW, or PLI instruction if:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1267
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
A PLI instruction must not perform any access that cannot be performed by a speculative instruction fetch by the
processor. Therefore:
• If a location is marked as Execute Never and Device, for the VMSA translation regime or PMSA memory
region at the current level of privilege and at any higher level of privilege a PLI instruction cannot cause an
access to that location.
• In a VMSA implementation, if all associated MMUs are disabled, a PLI instruction cannot access any
memory location that cannot be accessed by instruction fetches.
Note
In ARMv6, a speculative instruction fetch is provided by the optional Prefetch instruction cache line operation in
CP15 c7, with encoding <opc1> == 0, <CRm> == c13, <opc2> == 1, see CP15 c7, Cache and branch predictor
operations on page D12-2518.
Cache lockdown
Cache lockdown requirements can conflict with the management of hardware coherency. For this reason, ARMv7
introduces significant changes in this area, compared to previous versions of the ARM architecture. These changes
recognize that, in many systems, cache lockdown is inappropriate.
• If cache lockdown is supported, the lockdown mechanism is IMPLEMENTATION DEFINED. However key
properties of the interaction of lockdown with the architecture must be described in the implementation
documentation.
• The Cache Type Register does not hold information about lockdown. This is a change from ARMv6.
However some CP15 c9 encodings are available for IMPLEMENTATION DEFINED cache lockdown features, see
IMPLEMENTATION DEFINED memory system features on page B2-1290.
Note
For details of cache lockdown in ARMv6 see CP15 c9, Cache lockdown support on page D12-2523.
This means the mechanism for cache enabling and disabling caches changes in ARMv7. In ARMv6, and in earlier
versions of the architecture, SCTLR.C and SCTLR.I control enabling and disabling of caches, see:
• SCTLR, System Control Register, VMSA on page B4-1700, for a VMSA implementation.
• SCTLR, System Control Register, PMSA on page B6-1921, for a PMSA implementation.
In ARMv7:
• SCTLR.C enables or disables all data and unified caches for data accesses, across all levels of cache visible
to the processor. It is IMPLEMENTATION DEFINED whether it also enables or disables the use of unified caches
for instruction accesses.
B2-1268 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
• SCTLR.I enables or disables all instruction caches, across all levels of cache visible to the processor.
• If an implementation requires finer-grained control of cache enabling, it can implement control bits in the
Auxiliary Control Register for this purpose. For example, an implementation might define control bits to
enable and disable the caches at a particular level. For more information about the Auxiliary Control Register,
see:
— ACTLR, IMPLEMENTATION DEFINED Auxiliary Control Register, VMSA on page B4-1518, for a
VMSA implementation.
— ACTLR, IMPLEMENTATION DEFINED Auxiliary Control Register, PMSA on page B6-1802, for a
PMSA implementation.
Note
In ARMv6, the SCTLR I, C, and W bits provide separate enables for the level 1 instruction cache, if implemented,
the level 1 data or unified cache, and write buffering.
When a cache is disabled for a type of access, for a particular translation regime:
• It is IMPLEMENTATION DEFINED whether a cache hit occurs if a location that is held in the cache is accessed
by that type of access.
• Any location that is not held in the cache is not brought into the cache as a result of a memory access of that
type.
Note
When interpreting this requirement for a PMSA implementation, all memory accesses belong to a single translation
regime that provides a flat mapping from input address to output address.
It is IMPLEMENTATION DEFINED whether the following bits affect the memory attributes generated by an enabled
MMU or MPU:
• For execution in Hyp mode, HSCTLR.{C, I}.
• For execution in any other mode, SCTLR.{C, I}.
In an implementation where the {C, I} bits can affect the generated memory attributes:
• If the implementation is a VMSAv7 implementation that includes the Virtualization Extensions, HCR.DC is
set to 1, and SCTLR.M is set to 0, then for execution using a PL1&0 translation regime the {C, I} bits have
no effect on cacheability.
• Otherwise:
— When a C bit is set to 0, disabling the data or unified cache for the corresponding translation regime,
data accesses, and translation table walks from that translation regime to any Normal memory region
behave as Non-cacheable for all levels of data or unified cache.
Note
Setting a C bit to 0 has no effect on the behavior of instruction accesses.
— When an I bit is set to 0, disabling the instruction cache for the corresponding translation regime,
instruction accesses from that translation regime to any Normal memory region behave as
Non-cacheable for all levels of instruction cache.
For implementations where the {C, I} bits can affect the generated memory attributes, this otherwise case
applies to all PMSA implementations, and to a VMSA implementation where any of the following applies:
— The implementation does not include the Virtualization Extensions.
— HCR.DC is set to 0, or SCTLR.M is set to 1.
— Execution is not using a PL1&0 translation regime.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1269
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Note
Regardless of whether the {C, I} bits affect the memory attributes, when a cache is disabled for a type of memory
access, a memory location that is not held in the cache is never brought into the cache as a result of a memory access
of that type.
If the MMU or MPU is disabled, the following sections describe the effects of SCTLR.{C, I} on the memory
attributes:
• The effects of disabling MMUs on VMSA behavior on page B3-1312 for the MMU.
• Behavior when the MPU is disabled on page B5-1750 for the MPU.
An invalidate all operation on the branch predictor ensures that any location held in the branch predictor has no
functional effect on execution. An invalidate branch predictor by MVA operation operates on the address of the
branch instruction, but can affect other branch predictor entries.
Note
The architecture does not make visible the range of addresses in a branch predictor to which the invalidate operation
applies. This means the address used in the invalidate by MVA operation must be the address of the branch to be
invalidated.
If branch prediction is architecturally visible, an instruction cache invalidate all operation also invalidates all branch
predictors.
• Any change to the TTBR0, TTBR1, or TTBCR registers, unless accompanied by a change to the ContextID,
or a change to the VMID
• Changes to the VTTBR or VTCR registers, unless accompanied by a change to the VMID.
Note
Invalidation is not required if the changes to the translations are such that the instructions associated with the
non-faulting translations of a virtual address, for a given translation regime and a given ASID and VMID, as
appropriate, remain unchanged throughout the sequence of changes to the translations. Examples of translation
changes to which this applies are:
• Changing a valid translation to a translation that generates an MMU fault.
• Changing a translation that generates an MMU fault to a valid translation.
B2-1270 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Failure to invalidate entries might give UNPREDICTABLE results, caused by the execution of old branches. For more
information, see Ordering of cache and branch predictor maintenance operations on page B2-1287.
Note
• In ARMv7, there is no requirement to use the branch predictor maintenance operations to invalidate the
branch predictor after:
— Changing the ContextID or VMID, or changing the FCSE ProcessID in an implementation that
includes the FCSE.
— A cache operation that is identified as also flushing the branch predictors, see Cache and branch
predictor maintenance operations on page B2-1276.
• In ARMv6, the branch predictor must be invalidated after a change to the ContextID or FCSE ProcessID, see
CP15 c13, Context ID support on page D12-2530.
• If branch predictors are not architecturally invisible, the branch prediction logic is disabled at reset.
• An implementation can require the use of a specific branch predictor initialization routine to invalidate the
branch predictor storage array before it is enabled. The exact form of any required initialization routine is
IMPLEMENTATION DEFINED, but the routine must be documented clearly as part of the documentation of the
device.
• ARM recommends that whenever an invalidation routine is required, it is based on the ARMv7 branch
predictor maintenance operations.
When it is enabled, the state of the branch predictor logic is UNPREDICTABLE if the appropriate initialization routine
has not been performed.
For an implementation that does not include the Multiprocessing Extensions, the ARMv7 architecture defines these
operations as applying only to resources directly attached to the processor on which the operation is executed. This
means that there is no requirement for maintenance operations to influence other processors with which data can be
shared. If porting an architecturally-portable multiprocessor operating system to an implementation of the ARMv7
architecture that does not include the Multiprocessing Extensions, when a maintenance operation is performed, the
operating system must use Inter-Processor Interrupts (IPIs) to inform other processors in a multiprocessor
configuration that they must perform the equivalent operation.
The ARMv7 Multiprocessing Extensions provide enhanced support for multiprocessor implementations, including
extending the maintenance operations, so that some maintenance operations affect other processors in the system.
The Multiprocessing Extensions both:
• Change the effect of some existing maintenance operations.
• Add new maintenance operations.
The following sections include descriptions of the extensions to the maintenance operations:
• Cache and branch predictor maintenance operations on page B2-1276.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1271
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
When a uniprocessor implementation with no hardware support for cache coherency includes the Multiprocessing
Extensions, the Inner Shareable and Outer Shareable domains apply only to the single processor, and all instructions
defined to apply to the Inner Shareable domain behave as aliases of the local operations.
• CP15 c7, Cache and branch predictor operations on page D12-2518 for ARMv6.
• CP15 c7, Cache and branch predictor operations on page D15-2613 for the ARMv4 and ARMv5
architectures.
The following sections give general information about the ARMv7 cache and branch prediction maintenance
functionality:
• Terms used in describing the maintenance operations.
• The ARMv7 abstraction of the cache hierarchy on page B2-1275.
Cache and branch predictor maintenance operations on page B2-1276 describes the maintenance operations.
Requirements for branch predictor maintenance operations on page B2-1270 describes cases that require software
to perform branch predictor maintenance.
In addition, for instruction caches and branch predictors, there are operations that invalidate all entries.
The following subsections define the terms used in the descriptions of the cache operations:
• Terminology for operations by MVA.
• Terminology for operations by set/way on page B2-1273.
• Terminology for Clean, Invalidate, and Clean and Invalidate operations on page B2-1273.
The term Modified Virtual Address (MVA) relates to the Fast Context Switch Extension (FCSE) mechanism,
described in Appendix D10 Fast Context Switch Extension (FCSE). When the FCSE is absent or disabled, the MVA
and VA have the same value. However the term MVA is used throughout this section, and elsewhere in this manual,
for cache and TLB operations. This is consistent with previous issues of the ARM Architecture Reference Manual.
Note
From ARMv6, ARM deprecates any use of the FCSE. The FCSE is OPTIONAL and deprecated in an ARMv7
implementation that does not include the Multiprocessing Extensions, and is not supported by any implementation
that includes the Multiprocessing Extensions. That is, the Multiprocessing Extensions make the FCSE obsolete.
Virtual addresses only exist in systems with an MMU. When no MMU is implemented, or all applicable MMUs are
disabled, the MVA and VA are identical to the PA.
Note
For more information about memory system behavior when MMUs are disabled, see The effects of disabling MMUs
on VMSA behavior on page B3-1312.
B2-1272 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Cache maintenance operations by set/way refer to the particular structures in a cache. Three parameters describe the
location in a cache hierarchy that an operation works on. These parameters are:
Level The cache level of the hierarchy. The number of levels of cache is IMPLEMENTATION DEFINED, and
can be determined from the Cache Level ID Register, see:
• CLIDR, Cache Level ID Register, VMSA on page B4-1526 for a VMSA implementation.
• CLIDR, Cache Level ID Register, PMSA on page B6-1808 for a PMSA implementation.
In the ARM architecture, the lower numbered levels are those closest to the processor, see Memory
hierarchy on page A3-153.
Set Each level of a cache is split up into a number of sets. Each set is a set of locations in a cache level
to which an address can be assigned. Usually, the set number is an IMPLEMENTATION DEFINED
function of an address.
In the ARM architecture, sets are numbered from 0.
Way The Associativity of a cache defines the number of locations in a set to which an address can be
assigned. The way number specifies a location in a set.
In the ARM architecture, ways are numbered from 0.
1. An update to a memory location by a processor that accesses a cache might not be visible to other observers
that can access memory. This can occur because new updates are still in the cache and are not visible yet to
the other observers that do not access that cache.
2. Updates to memory locations by other observers that can access memory might not be visible to a processor
that accesses a cache. This can occur when the cache contains an old, or stale, copy of the memory location
that has been updated.
The Clean and Invalidate operations address these two issues. The definitions of these operations are:
Clean A cache clean operation ensures that updates made by an observer that controls the cache are made
visible to other observers that can access memory at the point to which the operation is performed.
Once the Clean has completed, the new memory values are guaranteed to be visible to the point to
which the operation is performed, for example to the point of unification.
The cleaning of a cache entry from a cache can overwrite memory that has been written by another
observer only if the entry contains a location that has been written to by an observer in the
shareability domain of that memory location.
Invalidate A cache invalidate operation ensures that updates made visible by observers that access memory at
the point to which the invalidate is defined are made visible to an observer that controls the cache.
This might result in the loss of updates to the locations affected by the invalidate operation that have
been written by observers that access the cache.
If the address of an entry on which the invalidate operates does not have a Normal Cacheable
attribute, or if the cache is disabled, then an invalidate operation also ensures that this address is not
present in the cache.
Note
Entries for addresses with a Normal Cacheable attribute can be allocated to an enabled cache at any
time, and so the cache invalidate operation cannot ensure that the address is not present in an
enabled cache.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1273
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
The points to which a cache maintenance operation can be defined differ depending on whether the operation is by
MVA or by set/way:
• For set/way operations, and for All (entire cache) operations, the point is defined to be to the next level of
caching.
B2-1274 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Performing cache maintenance operations on page B2-1284 gives more information about the cache maintenance
operations, including an example of cache maintenance code, that can be adapted for other cache operations.
The addressed-based cache operations are described as operating by MVA. Each of these operations is always
qualified as being one of:
• Performed to the point of coherency.
• Performed to the point of unification.
See Terms used in describing the maintenance operations on page B2-1272 for definitions of point of coherency
and point of unification, and more information about possible meanings of MVA.
Summary of cache and branch predictor maintenance operations on page B2-1276 lists the address-based
maintenance operations.
These values support efficient invalidation of a range of addresses, because this value is the most efficient address
stride to use to apply a sequence of address-based maintenance operations to a range of addresses.
For the Invalidate data or unified cache line by MVA operation, the Cache Write-back Granule field of the CTR
defines the maximum granule that a single invalidate instruction can invalidate. This meaning of the Cache
Write-back Granule is in addition to its defining the maximum size that can be written back.
Summary of cache and branch predictor maintenance operations on page B2-1276 lists the set/way-based
maintenance operations. The CP15 c7 encodings of these operations include a required field that specifies the cache
level for the operation:
• A clean operation cleans from the level of cache specified through to at least the next level of cache, moving
further from the processor.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1275
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Note
Other cache maintenance operations specified in ARMv6 are not supported in ARMv7. Their associated encodings
in CP15 c7 are UNPREDICTABLE.
An ARMv7 implementation can add additional IMPLEMENTATION DEFINED cache maintenance functionality using
CP15 c15 operations, if this is required.
In a VMSA implementation, some maintenance operations that take an MVA as an argument can generate an MMU
fault. The fault descriptions in MMU faults on page B3-1400 identify these cases.
General requirements for the scope of maintenance operations on page B2-1279 gives information that applies to
all of these operations. Where appropriate, the operation summaries give cross-references to subsections that give
additional information that is relevant to that operation.
Any of these operations can be applied to any data cache, or to any unified cache. The supported operations, grouped
by the argument required for the operation, are:
Operations by MVA
The data and unified cache operations by MVA are:
DCIMVAC Invalidate, to point of coherency.
DCCMVAC Clean, to point of coherency.
DCCMVAU Clean, to point of unification.
DCCIMVAC Clean and invalidate, to point of coherency.
These operations invalidate, clean, or clean and invalidate a data or unified cache line based on the
address it contains. For more information, see:
• Requirements for operations by MVA on page B2-1278.
• For an implementation that includes the Multiprocessing Extensions:
— For the operations to the point of coherency, Effect of the Multiprocessing Extensions
on operations to the point of coherency on page B2-1279.
— For DCCMVAU, Effect of the Multiprocessing Extensions on operations not to the
point of coherency on page B2-1280.
B2-1276 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
For a data or unified cache maintenance operation by MVA, the operation cannot generate a Data
Abort exception for a Domain fault or a Permission fault, except for the Permission fault cases
described in:
• Virtualization Extensions upgrading of maintenance operations on page B2-1284.
• Stage 2 fault on a stage 1 translation table walk, Virtualization Extensions on page B3-1399.
For more information about these faults, see MMU faults on page B3-1400.
Operations by set/way
The data and unified cache operations by set/way are:
DCISW Invalidate.
DCCSW Clean.
DCCISW Clean and invalidate, to point of coherency.
These operations invalidate, clean, or clean and invalidate a data or unified cache line based on its
location in the cache hierarchy. For more information, see:
• Requirements for operations by set/way on page B2-1278.
• For an implementation that includes the Multiprocessing Extensions, Effect of the
Multiprocessing Extensions on All and set/way maintenance operations on page B2-1281.
Note
The possible presence of system caches, as described in System level caches on page B2-1288 means architecture
does not guarantee that all levels of the cache can be maintained using set/way instructions.
Operation by MVA
ICIMVAU Invalidate, to point of unification.
This instruction invalidates an instruction cache line based on the address it contains. For more
information, see:
• Requirements for operations by MVA on page B2-1278.
• For an implementation that includes the Multiprocessing Extensions, Effect of the
Multiprocessing Extensions on operations not to the point of coherency on page B2-1280.
For an instruction cache maintenance operation by MVA:
• It is IMPLEMENTATION DEFINED whether the operation can generate a Data Abort exception
for a Translation fault or an Access flag fault.
• The operation cannot generate a Data Abort exception for a Domain fault or a Permission
fault, except for the Permission fault case described in Stage 2 fault on a stage 1 translation
table walk, Virtualization Extensions on page B3-1399.
For more information about these faults, see MMU faults on page B3-1400.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1277
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Operation by MVA
BPIMVA Invalidate.
Invalidates the branch predictor based on a branch address. For more information, see:
• Requirements for operations by MVA.
• For an implementation that includes the Multiprocessing Extensions, Effect of the
Multiprocessing Extensions on operations not to the point of coherency on page B2-1280.
For a branch predictor maintenance operation by MVA:
• It is IMPLEMENTATION DEFINED whether the operation can generate a Data Abort exception
for a Translation fault or an Access flag fault.
• The operation cannot generate a Data Abort exception for a Domain fault or a Permission
fault, except for the Permission fault case described in Stage 2 fault on a stage 1 translation
table walk, Virtualization Extensions on page B3-1399.
For more information about these faults, see MMU faults on page B3-1400.
In the cache operations, any operation described as operating by MVA includes as part of any required MVA to PA
translation:
• For an operation performed at PL1, the current system Address Space Identifier (ASID).
• If the implementation includes the Security Extensions, the current security state.
• If the implementation includes the Virtualization Extensions:
— Whether the operation was performed from Hyp mode, or from a Non-secure PL1 mode.
— For an operation performed from a Non-secure PL1 mode, the virtual machine identifier (VMID).
Cache maintenance operations that work by set/way use the level, set and way values to determine the location acted
on by the operation. The address in memory that corresponds to this cache location is determined by the cache.
Note
Because the allocation of a memory address to a cache location is entirely IMPLEMENTATION DEFINED, ARM expects
that most portable software will use only the set/way operations as single steps in a routine to perform maintenance
on the entire cache.
B2-1278 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
The ARMv7 specification of the cache maintenance operations describes what each operation is guaranteed to do
in a system. It does not limit other behaviors that might occur, provided they are consistent with the requirements
described in Cache behavior on page B2-1265 and in Branch predictors on page B2-1270.
• As a side-effect of a branch predictor maintenance operation, any entry in the branch predictor might be
invalidated.
Note
ARM recommends that, for best performance, such side-effects are kept to a minimum. In particular, in an
implementation that includes the Security Extensions, ARM strongly recommends that the side-effects of operations
performed in Non-secure state do not have a significant performance impact on execution in Secure state.
• If the implementation includes the Security Extensions, each security state has its own physical address
space, affecting the required and permitted scope of cache maintenance operations.
• The Virtualization Extensions add additional requirements for the cache maintenance operations.
Effects of the Security and Virtualization Extensions on the maintenance operations on page B2-1282 describes
these effects.
The Multiprocessing Extensions add requirements for the scope of the following operations, that affect data and
unified caches to the point of coherency:
• Invalidate data, or unified, cache line by MVA to the point of coherency, DCIMVAC.
• Clean data, or unified, cache line by MVA to the point of coherency, DCCMVAC.
• Clean and invalidate data, or unified, cache line by MVA to the point of coherency, DCCIMVAC.
For Normal memory that is not Inner Non-cacheable, Outer Non-cacheable, these instructions must affect the caches
of other processors in the shareability domain described by the shareability attributes of the MVA supplied with the
operation.
In the following cases, these operations must affect the caches of all processors in the Outer Shareable shareability
domain of the processor on which the operation is performed:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1279
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
• In an implementation that includes the Large Physical Address Extension, for Device memory. When using
the Short-descriptor translation table format this requirement applies regardless of any shareability attribute
applied to the region. This means that any PRRR.NOS bit that applies to the Device memory region has no
effect on the scope of the operation.
On an implementation that does not include the Large Physical Address Extension, for Device memory it is
IMPLEMENTATION DEFINED which of the following applies:
• These operations affect the caches of other processors in the Outer Shareable shareability domain.
• These operations affect the caches of other processors in the shareability domain defined by the shareability
attributes of the MVA passed with the instruction.
On an implementation that includes the Large Physical Address Extension and is using the Short-descriptor
translation table format, for Normal memory that is Inner Non-cacheable, Outer Non-cacheable, it is
IMPLEMENTATION DEFINED which of the following applies:
• These operations affect the caches of other processors in the Outer Shareable shareability domain.
• These operations affect the caches of other processors in the shareability domain defined by the shareability
attributes of the MVA passed with the instruction.
In all cases, for any affected processor, these operations affect all data and unified caches to the point of coherency.
For the cases where the shareability attribute of the MVA supplied with the operation determines the scope of the
operation, Table B2-1 shows how this attribute determines the minimum set of processors affected, and the point to
which the operation must be effective.
Non-shareable The processor performing the operation Point of coherency of the entire system
Inner Shareable All processors in the same Inner Shareable shareability domain as the Point of coherency of the entire system
processor performing the operation
Outer Shareable All processors in the same Outer Shareable shareability domain as the Point of coherency of the entire system
processor performing the operation
The Multiprocessing Extensions add requirements for the scope of the following operations, that operate by MVA
but not to the point of coherency:
• Clean data, or unified, cache line by MVA to the point of unification, DCCMVAU.
• Invalidate instruction cache line by MVA to point of unification, ICIMVAU.
• Invalidate MVA from branch predictors, BPIMVA.
• For an MVA in a Strongly-ordered or Device memory region, these operations apply to all processors in the
Inner Shareable shareability domain.
Note
For Device memory, this requirement applies regardless of the current translation table format. When using
the Short-descriptor format, the shareability attribute of a Device memory region has no effect on the scope
of these operations. This means that any PRRR.NOS bit that applies to the Device memory region has no
effect on the scope of the operation.
• When the implementation is using the Short-descriptor translation table format, for Normal memory that is
Inner Non-cacheable, Outer Non-cacheable, it is IMPLEMENTATION DEFINED which of the following applies:
— These operations affect the caches of other processors in the Inner Shareable shareability domain.
B2-1280 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
— These operations affect the caches of other processors in the shareability domain defined by the
shareability attributes of the MVA passed with the instruction.
• Table B2-2 shows how, for an MVA in a Normal or Device memory region, the shareability attribute of the
MVA determines the minimum set of processors affected, and the point to which the operation must be
effective.
• The scope of an operation using an MVA in a Strongly-Ordered memory region is the same as that shown, in
Table B2-2, for an address with an Inner Shareable or Outer Shareable attribute.
Non-shareable The processor performing the Point of unification of instruction cache fills, data cache fills and write-backs,
operation and translation table walks, on the processor performing the operation
Inner Shareable or All processors in the same Inner To the point of unification of instruction cache fills, data cache fills and
Outer Shareable Shareable shareability domain write-backs, and translation table walks, of all processors in the same Inner
as the processor performing the Shareable shareability domain as the processor performing the operation
operation
Note
The set of processors guaranteed to be affected is never greater than the processors in the Inner Shareable
shareability domain containing the processor performing the operation.
For an implementation that includes the Multiprocessing Extension, this section describes the
architecturally-required effect of local and Inner Shareable instructions for cache and branch predictor maintenance
operations that operate on all entries, or operate by set/way:
Local instructions
The only architectural guarantee for the following instructions is that they apply to the caches or
branch predictors of the processor that performs the operation:
• Invalidate entire instruction cache, ICIALLU.
• Invalidate all branch predictors, BPIALL.
• Clean and Invalidate data or unified cache line by set/way, DCCISW.
• Clean data or unified cache line by set/way, DCCSW.
• Invalidate data or unified cache line by set/way, DCISW.
That is, these operations have an effect only on the processor that performs the operation.
If the branch predictors are architecturally-visible, ICIALLU also performs a BPIALL operation.
These operations are functionally unchanged from their operation in an ARMv7 implementation
that does not include the Multiprocessing Extensions.
Note
Since the set/way instructions are performed only locally, there is no guarantee of the atomicity of
cache maintenance between different processors, even if those different processors are each
performing the same cache maintenance instructions at the same time. Since any cacheable line can
be allocated into the cache at any time, it is possible for cache line to migrate from an entry in the
cache of one processor to the cache of a different processor in a manner that the cache line avoids
being affected by set/way based cache maintenance. Therefore, ARM strongly discourages the use
of set/way instructions to manage coherency in coherent systems.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1281
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
In an implementation that includes the Security Extensions, each Security state has its own physical address space,
and therefore cache and branch predictor entries are associated with a physical address space. In addition, in an
implementation that includes the Virtualization Extensions, cache and branch predictor maintenance operations
performed in Non-secure state have to take account of:
• Whether the operation was performed at PL1 or at PL2.
• For operations by MVA, the current VMID.
Table B2-3 shows the effect of the Security and Virtualization Extensions on these maintenance operations.
Table B2-3 Effect of the Security and Virtualization Extensions on the maintenance operations
Security
Cache operation Targeted entry
state
Invalidate, Clean, or Either All lines that hold the PA that, in the current security state, is mapped to by the
Clean and Invalidate by combination of all of a:
MVA: DCIMVAC, • The specified MVA.
DCCMVAC,
• The current ASID.
DCCMVAU,
DCCIMVAC • In an implementation that includes the Virtualization Extensions, for an
operation performed in a Non-secure PL1 mode, the current VMID b.
Invalidate, Clean, or Non-secure Line specified by set/way provided that the entry comes from the Non-secure PA
Clean and Invalidate by space. a
set/way: DCISW,
DCCSW, DCCISW Secure Line specified by set/way regardless of the PA space that the entry has come from.
Invalidate by MVA: Either All lines that match the specified VA, come from the VA space of the current Security
ICIMVAU state, and for the PL1 translation regime match the current ASID. In an
implementation that includes the Virtualization Extensions, for an instruction
executed in Non-secure state, lines are invalidated only if they also match the current
privilege level, and for the PL1 translation regime, the current VMID b.
B2-1282 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Table B2-3 Effect of the Security and Virtualization Extensions on the maintenance operations (continued)
Security
Cache operation Targeted entry
state
Invalidate All: ICIALLU, • Can invalidate any unlocked entry in the instruction cache.
ICIALLUIS • Are required to invalidate any entries relevant to the software component that executed it. The
Non-secure and Secure descriptions give more information.
Invalidate by MVA: Either All entries that match the specified MVA and the current ASID, and come from the
BPIMVA same VA space as the current Security state. In an implementation that includes the
Virtualization Extensions, for an operation performed in Non-secure state, entries are
invalidated only if they also match the current VMID b and security level, PL1 or PL2.
Invalidate all: BPIALL, • Can invalidate any unlocked entry in the instruction cache.
BPIALLIS • Are required to invalidate any entries relevant to the software component that executed it. The
Non-secure and Secure descriptions give more information.
For locked entries and entries that might be locked, the behavior of cache maintenance operations described in The
interaction of cache lockdown with cache maintenance operations on page B2-1286 applies. This behavior is not
affected by either the Security Extensions or the Virtualization Extensions.
With an implementation that generates aborts if entries are locked or might be locked in the cache, when the use of
lockdown aborts is enabled, these aborts can occur on any cache maintenance operation regardless of the Security
Extensions.
For more information about the cache maintenance operations, see About ARMv7 cache and branch predictor
maintenance functionality on page B2-1272 and Cache and branch predictor maintenance operations, VMSA on
page B4-1735.
An implementation that includes the Virtualization Extensions has the following additional requirements for cache
maintenance:
• The architecture does not require cache cleaning when switching between virtual machines. Cache
invalidation by set/way must not present an opportunity for one virtual machine to corrupt state associated
with a second virtual machine. To ensure this requirement is met, Non-secure clean by set/way operations
can be upgraded to clean and invalidate by set/way.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1283
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
• A data or unified clean by MVA operation performed in a Non-secure PL1 mode must not cause a change to
a data location for which the stage 2 translation properties do not permit write access.
For more information about these cases, see Virtualization Extensions upgrading of maintenance operations.
• When HCR.FB is set to 1, for maintenance operations performed in a Non-secure PL1 mode:
— An ICIALLU is broadcast across the Inner Shareable domain. This means it is upgraded to
ICIALLUIS.
— A BPIALL is broadcast across the Inner Shareable domain. This means it is upgraded to BPIALLIS.
• When HCR.SWIO is set to 1, an invalidate by set/way performed in a Non-secure PL1 mode is treated as a
clean and invalidate by set/way. This means DCISW is upgraded to DCCISW.
As indicated in Additional requirements of the Virtualization Extensions on page B2-1283, a Data or unified cache
invalidation by MVA operation performed in a Non-secure PL1 mode must not cause a change to data in a location
for which the stage 2 translation permissions do not permit write access. Where such a permission violation occurs,
it is IMPLEMENTATION DEFINED whether:
• A stage 2 Permission fault is generated for the DCIMVAC operation.
• The DCIMVAC operation is upgraded to DCCIMVAC.
Note
Functionally, upgrading DCIMVAC to DCCIMVAC is acceptable for any data invalidate by MVA executed in a
Non-secure PL1 mode. Therefore, the implementation documentation might not specify the exact conditions in
which this upgrade occurs. Possible approaches are to upgrade DCIMVAC to DCCIMVAC:
• For any Non-secure PL1 operation when the stage 2 MMU is enabled.
• Only if a stage 2 Permission fault is detected.
• For data or unified cache maintenance, uses the CTR.DMINLINE value to determine the loop increment size
for a loop of data cache maintenance by MVA operations.
• For instruction cache maintenance, uses the CTR.IMINLINE value to determine the loop increment size for
a loop of instruction cache maintenance by MVA operations.
The code sequence given in this subsection illustrates a generic mechanism for cleaning the entire data or unified
cache to the point of coherency.
Note
In a multiprocessor implementation where multiple processors share a cache before the point of coherency, running
this sequence on multiple processors results in the operations being repeated on the shared cache.
B2-1284 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Skip
ADD R10, R10, #2 ; increment the cache number
CMP R3, R10
BGT Loop1
DSB
Finished
Note
Cache maintenance by set/way does not happen on multiple processors, and cannot be made to happen atomically
for each address on each processor. Therefore, in multiprocessor systems, the use of cache maintenance to clean, or
clean and invalidate, the entire cache for coherency management with very large buffers or with buffers with
unknown address can fail to provide the expected coherency results because of speculation by other processors. The
only way that these instructions can be used in this way is to first ensure that all processors that might cause
speculative accesses to caches that need to be maintained are not capable of generating speculative accesses. This
can be achieved by ensuring that those processors have no memory locations marked as cacheable. Such an
approach can have very large system performance effects, and ARM advises implementers to use hardware
coherency mechanisms in systems where this will be an issue.
Cache maintenance operations operate on the caches when the caches are enabled or when they are disabled.
For the address-based cache maintenance operations, the operations operate on the caches regardless of the memory
type and cacheability attributes marked for the memory address in the VMSA translation table entries or in the
PMSA section attributes. This means that the cache operations can apply regardless of:
• Whether the address accessed:
— Is Strongly-ordered, Device, or Normal memory.
— Has a Cacheable attribute, or the Non-cacheable attribute.
• Any applicable domain control of the address accessed.
• The access permissions for the address accessed, other than the effect of the stage 2 write permissions on
cache invalidation operations on a data or unified cache, as described in Virtualization Extensions upgrading
of maintenance operations on page B2-1284.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1285
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
• The effect of the following operations on locked cache entries is IMPLEMENTATION DEFINED:
— Cache clean by set/way, DCCSW.
— Cache invalidate by set/way, DCISW.
— Cache clean and invalidate by set/way, DCCISW.
— Instruction cache invalidate all, ICIALLU and ICIALLUIS.
However, one of the following approaches must be adopted in all these cases:
1. If the operation specified an invalidation, a locked entry is not invalidated from the cache. If the
operation specified a clean it is IMPLEMENTATION DEFINED whether locked entries are cleaned.
2. If an entry is locked down, or could be locked down, an IMPLEMENTATION DEFINED Data Abort
exception is generated, using the fault status code defined for this purpose in CP15 c5, see either:
• Exception reporting in a VMSA implementation on page B3-1406.
• Exception reporting in a PMSA implementation on page B5-1761.
This permits a usage model for cache invalidate routines to operate on a large range of addresses by
performing the required operation on the entire cache, without having to consider whether any cache entries
are locked. The operation performed is either an invalidate, or a clean and invalidate.
Note
An implementation that uses an abort mechanism for entries that can be locked down but are not actually locked
down must:
• Document the IMPLEMENTATION DEFINED instruction sequences that perform the required operations on
entries that are not locked down.
• Implement one of the other permitted alternatives for the locked entries.
ARM recommends that, when possible, such IMPLEMENTATION DEFINED instruction sequences use
architecturally-defined operations. This minimizes the number of customized operations required.
In addition, an implementation that uses an abort mechanism for handling cache maintenance operations on entries
that can be locked down but are not actually locked down, must provide a mechanism that ensures that no cache
entries are locked. The reset setting of the cache must be that no cache entries are locked.
B2-1286 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
On an ARMv7-A implementation, similar rules apply to TLB lockdown, see The interaction of TLB lockdown with
TLB maintenance operations on page B3-1379.
• Operations that preload into specific levels of cache. These operations might be provided for instruction
caches, data caches, or both.
• All cache and branch predictor maintenance operations that do not specify an address execute, relative to
each other, in program order.
All cache and branch predictor operations that specify an address:
— Execute in program order relative to all cache and branch predictor operations that do not specify an
address.
— Execute in program order relative to all cache and branch predictor operations that specify the same
address.
— Can execute in any order relative to cache and branch predictor operations that specify a different
address.
• On an ARMv7-A implementation:
— Where a cache or branch predictor maintenance operation appears in program order before a change
to the translation tables, the architecture guarantees that the cache or branch predictor maintenance
operation uses the translations that were visible before the change to the translation tables.
— Where a change of the translation tables appears in program order before a cache or branch predictor
maintenance operation, software must execute the sequence outlined in TLB maintenance operations
and the memory order model on page B3-1379 before performing the cache or branch predictor
maintenance operation, to ensure that the maintenance operation uses the new translations.
• A DMB instruction causes the effect of all data or unified cache maintenance operations appearing in program
order before the DMB to be visible to all explicit load and store operations appearing in program order after the
DMB.
Also, a DMB instruction ensures that the effects of any data or unified cache maintenance operations appearing
in program order before the DMB are observable by any observer in the same required shareability domain
before any data or unified cache maintenance or explicit memory operations appearing in program order after
the DMB are observed by the same observer. Completion of the DMB does not guarantee the visibility of all data
to other observers. For example, all data might not be visible to a translation table walk, or to instruction
fetches.
• A DSB is required to guarantee the completion of all cache maintenance operations that appear in program
order before the DSB instruction.
• A context synchronization operation is required to guarantee the effects of any branch predictor maintenance
operation. This means that a context synchronization operation causes the effect of all completed branch
predictor maintenance operations appearing in program order before the context synchronization operation
to be visible to all instructions after the context synchronization operation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1287
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
Note
See Context synchronization operation in the Glossary for the definition of this term.
This means that, if a branch instruction appears after an invalidate branch predictor operation and before any
context synchronization operation, it is UNPREDICTABLE whether the branch instruction is affected by the
invalidate. Software must avoid this ordering of instructions, because it might cause UNPREDICTABLE
behavior.
• Any data or unified cache maintenance operation by MVA must be executed in program order relative to any
explicit load or store on the same processor to an address covered by the MVA of the cache operation if that
load or store is to Normal Cacheable memory. The order of memory accesses that result from the cache
maintenance operation, relative to any other memory accesses to Normal Cacheable memory, are subject to
the memory ordering rules. For more information, see Ordering requirements for memory accesses on
page A3-146.
Any data or unified cache maintenance operation by MVA can be executed in any order relative to any
explicit load or store on the same processor to an address covered by the MVA of the cache operation if that
load or store is not to Normal Cacheable memory.
• There is no restriction on the ordering of data or unified cache maintenance operations by MVA relative to
any explicit load or store on the same processor where the address of the explicit load or store is not covered
by the MVA of the cache operation. Where the ordering must be restricted, a DMB instruction must be inserted
to enforce ordering.
• There is no restriction on the ordering of a data or unified cache maintenance operation by set/way relative
to any explicit load or store on the same processor. Where the ordering must be restricted, a DMB instruction
must be inserted to enforce ordering.
• Software must execute a context synchronization operation after the completion of an instruction cache
maintenance operation, to guarantee that the effect of the maintenance operation is visible to any instruction
fetch.
In a VMSAv7 implementation, the scope of instruction cache maintenance depends on the type of the instruction
cache. For more information, see Instruction caches on page B3-1389.
The sequence of cache cleaning operations for a line of self-modifying code on a uniprocessor system is:
; Enter this code with <Rx> containing the new 32-bit instruction. Use STRH in the first
; line instead of STR for a 16-bit instruction.
STR <Rx>, [instruction location]
DCCMVAU [instruction location] ; Clean data cache by MVA to point of unification
DSB ; Ensure visibility of the data cleaned from the cache
ICIMVAU [instruction location] ; Invalidate instruction cache by MVA to PoU
BPIMVAU [instruction location] ; Invalidate branch predictor by MVA to PoU
DSB ; Ensure completion of the invalidations
ISB ; Synchronize fetched instruction stream
B2-1288 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.2 Caches and branch predictors
1. System caches which lie before the point of coherency and cannot be managed by any CP15 Cache
maintenance instructions. Such systems fundamentally undermine the concept of cache maintenance
instructions operating to the point of coherency, as they imply the use of non-architecture mechanisms to
manage coherency. ARM deprecates the use of such systems.
2. System caches which lie before the point of coherency and can be managed by CP15 Cache maintenance by
Address that imply to the point of coherency, but cannot be managed by CP15 Cache maintenance by set/way
instructions. Where maintenance of the entirety of such a cache must be performed, as is the case for power
management, it must be performed using non-architectural mechanisms.
3. System caches which lie beyond the point of coherency and so are invisible to software. The management of
such caches is outside the scope of architecture.
• Wherever possible, all caches that require maintenance to ensure coherency are included in the caches
affected by the architecturally-defined CP15 cache maintenance operations, so that the
architecturally-defined software sequences for managing the memory model and coherency are sufficient for
managing all caches in the system.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1289
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.3 IMPLEMENTATION DEFINED memory system features
In particular, in ARMv7 the following memory system features are IMPLEMENTATION DEFINED:
• Cache lockdown, see Cache lockdown on page B2-1268.
• In VMSAv7, TLB lockdown, see TLB lockdown on page B3-1375.
• Tightly Coupled Memory (TCM) support, including any associated DMA scheme. The TCM Type Register,
TCMTR is required in all implementations, and if no TCMs are implemented this must be indicated by the
value of this register.
Note
For details of the optional TCMs and associated DMA scheme in ARMv6, see TCM support on
page D12-2505.
• The TCM Type Register, TCMTR, in CP15 c0, must be implemented. The following conditions apply to this
register:
— If no TCMs are implemented, the TCMTR indicates zero-size TCMs. For more information see
TCMTR, TCM Type Register, VMSA on page B4-1708 or TCMTR, TCM Type Register, PMSA on
page B6-1927.
— If bits[31:29] are 0b100, the format of the rest of the register format is IMPLEMENTATION DEFINED. This
value indicates that the implementation includes TCMs that do not follow the ARMv6 usage model.
Other fields in the register might give more information about the TCMs.
• The CP15 c9 encoding space with <CRm> = {0-2, 5-7} is IMPLEMENTATION DEFINED for all values of <opc2>
and <opc1>. This space is reserved for branch predictor, cache and TCM functionality, for example
maintenance, override behaviors and lockdown. It permits:
— ARMv6 backwards compatible schemes.
— Alternative schemes.
For more information, see:
— Cache and TCM lockdown registers, VMSA on page B4-1745, for a VMSA implementation.
— Cache and TCM lockdown registers, PMSA on page B6-1935, for a PMSA implementation.
• In a VMSAv7 implementation, part of the CP15 c10 encoding space is IMPLEMENTATION DEFINED and
reserved for TLB functionality, see TLB lockdown on page B3-1375.
• The CP15 c11 encoding space with <CRm> = {0-8, 15} is IMPLEMENTATION DEFINED for all values of <opc2>
and <opc1>. This space is reserved for DMA operations to and from the TCMs. It permits:
— An ARMv6 backwards compatible scheme.
— An alternative scheme.
For more information, see:
— VMSA CP15 c11 register summary, reserved for TCM DMA registers on page B3-1473, for a VMSA
implementation.
— PMSA CP15 c11 register summary, reserved for TCM DMA registers on page B5-1784, for a PMSA
implementation.
B2-1290 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
The pseudocode in this section applies to both VMSA and PMSA implementations. Additional pseudocode for
memory operations is given in:
• Pseudocode details of VMSA memory system operations on page B3-1498.
• Pseudocode details of PMSA memory system operations on page B5-1798.
// Types of memory
type MemoryAttributes is (
MemType type,
bits(2) innerattrs, // The possible encodings for each attributes field are as follows:
bits(2) outerattrs, // '00' = Non-cacheable; '10' = Write-Through
// '11' = Write-Back; '01' = RESERVED
bits(2) innerhints, // the possible encodings for the hints are as follows
bits(2) outerhints, // '00' = No-Allocate; '01' = Write-Allocate
// '10' = Read-Allocate; ;'11' = Read-Allocate and Write-Allocate
boolean innertransient,
boolean outertransient,
boolean shareable,
boolean outershareable
)
// Physical address type, with extra bits used by some VMSA features
type FullAddress is (
bits(40) physicaladdress,
bit NS // '0' = Secure, '1' = Non-secure
)
type AddressDescriptor is (
MemoryAttributes memattrs,
FullAddress paddress
)
type Permissions is (
bits(3) ap, // Access permission bits
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1291
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
• An 8-bit physical address extension, that is treated as additional high-order bits of the physical address. This
extension is always 0b00000000 in the PMSA.
• A single NS bit to select between Secure and Non-secure parts of the array. This bit is always 0 if the Security
Extensions are not implemented.
The actual implemented array of memory might be smaller than the 241 bytes implied. In this case, the scheme for
aliasing is IMPLEMENTATION DEFINED, or some parts of the address space might give rise to external aborts. For
more information, see:
• External aborts on page B3-1402 for a VMSA implementation.
• External aborts on page B5-1759 for a PMSA implementation.
Implementations might generate synchronous or asynchronous external aborts as a result of memory accesses, for
a variety of IMPLEMENTATION DEFINED reasons. The handling and reporting of these aborts is outside the scope of
the pseudocode.
The attributes in memaddrdesc.memattrs are used by the memory system to determine caching and ordering behaviors
as described in Memory types and attributes and the memory order model on page A3-123.
// AlignmentFault()
// ================
// TranslateAddress()
// ==================
B2-1292 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
Note
In versions of the architecture before ARMv7, if the SCTLR.A and SCTLR.U bits are both 0, an unaligned access
is forced to be aligned by replacing the low-order address bits with zeros.
// MemA[]
// ======
// MemA_unpriv[]
// =============
// MemA_with_priv[]
// ================
// Non-assignment form
bits(8*size) MemA_with_priv[bits(32) address, integer size, boolean privileged, boolean wasaligned]
// MMU or MPU
memaddrdesc = TranslateAddress(VA, privileged, FALSE, size, wasaligned);
return value;
// Assignment form
MemA_with_priv[bits(32) address, integer size, boolean privileged,
boolean wasaligned] = bits(8*size) value
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1293
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
else
// Legacy non alignment-checking configuration, SCTLR.{A, U} == {'0', '0'}
VA = Align(address, size);
// MMU or MPU
memaddrdesc = TranslateAddress(VA, privileged, TRUE, size, wasaligned);
// Effect on exclusives
if memaddrdesc.memattrs.shareable then
ClearExclusiveByAddress(memaddrdesc.paddress, ProcessorID(), size);
return;
In both cases:
Note
In versions of the architecture before ARMv7, if the SCTLR.A and SCTLR.U bits are both 0, an unaligned access
is forced to be aligned by replacing the low-order address bits with zeros.
// MemU[]
// ======
// MemU_unpriv[]
// =============
// MemU_with_priv[]
// ================
//
// Due to single-copy atomicity constraints, the aligned accesses are distinguished from
// the unaligned accesses:
// * aligned accesses are performed at their size
// * unaligned accesses are expressed as a set of byte accesses.
B2-1294 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
// Non-assignment form
elsif HaveVirtExt() && !IsSecure() && CurrentModeIsHyp() && HSCTLR.A == '1' then
// Access from Hyp mode faults if HSCTLR.A == '1'
AlignmentFault(address, FALSE);
else
// Permitted unaligned access. For ARMv7 this is either:
// HSCTLR.A == '0', for an access from Hyp mode.
// SCTLR.A == '0', for an access from a mode other than Hyp mode.
for i = 0 to size-1
value<8*i+7:8*i> = MemA_with_priv[address+i, 1, privileged, FALSE];
if CPSR.E == '1' then
value = BigEndianReverse(value, size);
return value;
// Assignment form
elsif HaveVirtExt() && !IsSecure() && CurrentModeIsHyp() && HSCTLR.A == '1' then
// Access from Hyp mode faults if HSCTLR.A == '1'
AlignmentFault(address, TRUE);
else
// Permitted unaligned access. For ARMv7 this is either:
// HSCTLR.A == '0', for an access from Hyp mode.
// SCTLR.A == '0', for an access from a mode other than Hyp mode.
if CPSR.E == '1' then
value = BigEndianReverse(value, size);
for i = 0 to size-1
MemA_with_priv[address+i, 1, privileged, FALSE] = value<8*i+7:8*i>;
return;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1295
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
// BigEndianReverse()
// ==================
// SetExclusiveMonitors()
// ======================
if memaddrdesc.memattrs.shareable then
MarkExclusiveGlobal(memaddrdesc.paddress, ProcessorID(), size);
// ExclusiveMonitorsPass()
// =======================
if passsed then
ClearExclusiveLocal(ProcessorID());
if memaddrdesc.memattrs.shareable then
passed = passed && IsExclusiveGlobal(memaddrdesc.paddress, ProcessorID(), size);
B2-1296 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
return passed;
The MarkExclusiveGlobal() procedure takes as arguments a FullAddress, paddress, the processor identifier
processorid and the size of the transfer. The procedure records that processor processorid has requested exclusive
access covering at least size bytes from address paddress. The size of region marked as exclusive is
IMPLEMENTATION DEFINED, up to a limit of 2KB, and no smaller than two words, and aligned in the address space
to the size of the region. It is UNPREDICTABLE whether this causes any previous request for exclusive access to any
other address by the same processor to be cleared.
The MarkExclusiveLocal() procedure takes as arguments a FullAddress paddress, the processor identifier
processorid and the size of the transfer. The procedure records in a local record that processor processorid has
requested exclusive access to an address covering at least size bytes from address paddress. The size of the region
marked as exclusive is IMPLEMENTATION DEFINED, and can at its largest cover the whole of memory, but is no
smaller than two words, and is aligned in the address space to the size of the region. It is IMPLEMENTATION DEFINED
whether this procedure also performs a MarkExclusiveGlobal() using the same parameters.
The IsExclusiveGlobal() function takes as arguments a FullAddress paddress, the processor identifier processorid
and the size of the transfer. The function returns TRUE if the processor processorid has marked in a global record
an address range as exclusive access requested that covers at least the size bytes from address paddress. It is
IMPLEMENTATION DEFINED whether it returns TRUE or FALSE if a global record has marked a different address as
exclusive access requested. If no address is marked in a global record as exclusive access, IsExclusiveGlobal()
returns FALSE.
The IsExclusiveLocal() function takes as arguments a FullAddress paddress, the processor identifier processorid
and the size of the transfer. The function returns TRUE if the processor processorid has marked an address range
as exclusive access requested that covers at least the size bytes from address paddress. It is IMPLEMENTATION
DEFINED whether this function returns TRUE or FALSE if the address marked as exclusive access requested does
not cover all of the size bytes from address paddress. If no address is marked as exclusive access requested, then
this function returns FALSE. It is IMPLEMENTATION DEFINED whether this result is ANDed with the result of
IsExclusiveGlobal() with the same parameters.
The ClearExclusiveByAddress() procedure takes as arguments a FullAddress paddress, the processor identifier
processorid, and the size of the transfer. The procedure clears the global records of all processors, other than
processorid, for which an address region including any of the size bytes starting from paddress has had a request
for an exclusive access. It is IMPLEMENTATION DEFINED whether the equivalent global record of the processor
processorid is also cleared if any of the size bytes starting from paddress has had a request for an exclusive access,
or if any other address has had a request for an exclusive access.
The ClearExclusiveLocal() procedure takes as arguments the processor identifier processorid. The procedure clears
the local record of processor processorid for which an address has had a request for an exclusive access. It is
IMPLEMENTATION DEFINED whether this operation also clears the global record of processor processorid that an
address has had a request for an exclusive access.
ClearExclusiveLocal(integer processorid)
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1297
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
// CheckPermission()
// =================
// Function used for permission checking at stage 1 of the translation process
// for the:
// VMSA Long-descriptor format
// VMSA Short-descriptor format
// PMSA format.
CheckPermission(Permissions perms, bits(32) mva, integer level, bits(4) domain, boolean iswrite,
boolean ispriv, boolean taketohypmode, boolean LDFSRformat)
secondstageabort = FALSE;
ipavalid = FALSE;
s2fs1walk = FALSE;
ipa = bits(40) UNKNOWN;
case perms.ap of
when '000' abort = TRUE;
when '001' abort = !ispriv;
when '010' abort = !ispriv && iswrite;
when '011' abort = FALSE;
when '100' UNPREDICTABLE;
when '101' abort = !ispriv || iswrite;
when '110' abort = iswrite;
when '111'
if MemorySystemArchitecture() == MemArch_VMSA then
abort = iswrite;
else
UNPREDICTABLE;
if abort then
DataAbort(mva, ipa, domain, level, iswrite, DAbort_Permission, taketohypmode,
secondstageabort, ipavalid, LDFSRformat, s2fs1walk);
return;
The following pseudocode describes the default memory access decoding for a PMSA implementation, and for a
VMSA implementation when TEX remap is not enabled:
// DefaultTEXDecode()
// ==================
MemoryAttributes memattrs;
case texcb of
when '00000' // Strongly-ordered
B2-1298 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
memattrs.type = MemType_StronglyOrdered;
memattrs.innerattrs = bits(2) UNKNOWN;
memattrs.innerhints = bits(2) UNKNOWN;
memattrs.outerattrs = bits(2) UNKNOWN;
memattrs.outerhints = bits(2) UNKNOWN;
memattrs.shareable = TRUE;
when '00001' // Shareable Device
memattrs.type = MemType_Device;
memattrs.innerattrs = bits(2) UNKNOWN;
memattrs.innerhints = bits(2) UNKNOWN;
memattrs.outerattrs = bits(2) UNKNOWN;
memattrs.outerhints = bits(2) UNKNOWN;
memattrs.shareable = TRUE;
when '00010' // Outer and Inner Write-Through, no Write-Allocate
memattrs.type = MemType_Normal;
memattrs.innerattrs = '10';
memattrs.innerhints = '10';
memattrs.outerattrs = '10';
memattrs.outerhints = '10';
memattrs.shareable = (S == '1');
when '00011' // Outer and Inner Write-Back, no Write-Allocate
memattrs.type = MemType_Normal;
memattrs.innerattrs = '11';
memattrs.innerhints = '10';
memattrs.outerattrs = '11';
memattrs.outerhints = '10';
memattrs.shareable = (S == '1');
when '00100' // Outer and Inner Non-cacheable
memattrs.type = MemType_Normal;
memattrs.innerattrs = '00';
memattrs.innerhints = '00';
memattrs.outerattrs = '00';
memattrs.outerhints = '00';
memattrs.shareable = (S == '1');
when '00110'
IMPLEMENTATION_DEFINED setting of memattrs;
when '00111' // Outer and Inner Write-Back, Write-Allocate
memattrs.type = MemType_Normal;
memattrs.innerattrs = '11';
memattrs.innerhints = '11';
memattrs.outerattrs = '11';
memattrs.outerhints = '11';
memattrs.shareable = (S == '1');
when '01000' // Non-shareable Device
memattrs.type = MemType_Device;
memattrs.innerattrs = bits(2) UNKNOWN;
memattrs.innerhints = bits(2) UNKNOWN;
memattrs.outerattrs = bits(2) UNKNOWN;
memattrs.outerhints = bits(2) UNKNOWN;
memattrs.shareable = TRUE;
when "1xxxx" // Cacheable, <3:2> = Outer attrs, <1:0> = Inner attrs
memattrs.type = MemType_Normal;
hintsattrs = ConvertAttrsHints(texcb<1:0>);
memattrs.innerattrs = hintsattrs<1:0>;
memattrs.innerhints = hintsattrs<3:2>;
hintsattrs = ConvertAttrsHints(texcb<3:2>);
memattrs.outerattrs = hintsattrs<1:0>;
memattrs.outerhints = hintsattrs<3:2>;
memattrs.shareable = (S == '1');
otherwise
UNPREDICTABLE;
memattrs.outershareable = memattrs.shareable;
return memattrs;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1299
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
For a synchronous abort, it also sets the DFAR to the MVA of the abort.
For details of the fault encoding values, see:
• For a VMSA implementation:
— PL1 fault reporting with the Short-descriptor translation table format on page B3-1411.
— Fault reporting with the Long-descriptor translation table format on page B3-1413.
• For a PMSA implementation, Fault Status Register encodings for the PMSA on page B5-1763.
An implementation might also set any IMPLEMENTATION DEFINED auxiliary fault reporting registers.
// DataAbort()
// ===========
DataAbort(bits(32) vaddress, bits(40) ipaddress, bits(4) domain, integer level, boolean iswrite,
DAbort type, boolean taketohypmode, boolean secondstageabort, boolean ipavalid,
boolean LDFSRformat, boolean s2fs1walk)
// Data Abort handling for Memory Management generated aborts
B2-1300 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
if domain_valid then
DFSRString<7:4> = domain;
else
DFSRString<7:4> = bits(4) UNKNOWN;
DFSRString<10,3:0> = EncodeSDFSR(type, level);
DFSR<13:0> = DFSRString;
else
bits(25) HSRString = Zeros(25);
bits(6) ec;
HDFAR = vaddress;
if ipavalid then
HPFAR<31:4> = ipaddress<39:12>;
if secondstageabort then
ec = '100100';
HSRString<24:16> = LSInstructionSyndrome();
else
ec = '100101';
HSRString<24> = '0'; // Instruction syndrome not valid
if type IN {DAbort_AsyncExternal,DAbort_SyncExternal} then
HSRString<9> = IMPLEMENTATION_DEFINED;
else
HSRString<9> = '0';
HSRString<8> = if TLBLookupCameFromCacheMaintenance() then '1' else '0';
HSRString<7> = if s2fs1walk then '1' else '0';
HSRString<6> = if iswrite then '1' else '0';
HSRString<5:0> = EncodeLDFSR(type, level);
WriteHSR(ec, HSRString);
else
// PMSA
bits(14) DFSRString = Zeros(14);
if type IN {DAbort_AsyncParity,DAbort_AsyncExternal,DAbort_AsyncWatchpoint} ||
(type == DAbort_SyncWatchpoint && UInt(DBGDIDR.Version) <= 4) then
DFAR = bits(32) UNKNOWN;
elseif type == DAbort_SyncParity then
DFAR = IMPLEMENTATION_DEFINED vaddress or unchanged;
else
DFAR = vaddress;
if type IN {DAbort_AsyncExternal,DAbort_SyncExternal} then
DFSRString<12> = IMPLEMENTATION_DEFINED;
else
DFSRString<12> = '0';
if type IN {DAbort_SyncWatchpoint,DAbort_AsyncWatchpoint} then
DFSRString<11> = bit UNKNOWN;
else
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1301
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
TakeDataAbortException();
return;
For a VMSA implementation, the EncodeSDFSR() pseudocode function returns the required fault code for a fault
status register that is reporting a Data Abort when using the Short-descriptor translation table format:
// EncodeSDFSR()
// =============
// Function that gives the Short-descriptor FSR code for
// different types of Data Abort
bits(5) result;
case type of
when DAbort_AccessFlag
if level == 1 then
result<4:0> = '00011';
else
result<4:0> = '00110';
when DAbort_Alignment
result<4:0> = '00001';
when DAbort_Permission
result<4:2> = '011';
result<0> = '1';
result<1> = level<1>;
when DAbort_Domain
result<4:2> = '010';
result<0> = '1';
result<1> = level<1>;
when DAbort_Translation
result<4:2> = '001';
result<0> = '1';
result<1> = level<1>;
when DAbort_SyncExternal
result<4:0> = '01000';
when DAbort_SyncExternalonWalk
result<4:2> = '011';
result<0> = '0';
result<1> = level<1>;
when DAbort_SyncParity
result<4:0> = '11001';
when DAbort_SyncParityonWalk
result<4:2> = '111';
result<0> = '0';
result<1> = level<1>;
when DAbort_AsyncParity
result<4:0> = '11000';
when DAbort_AsyncExternal
result<4:0> = '10110';
when DAbort_SyncWatchpoint, DAbort_AsyncWatchpoint
result<4:0> = '00010';
when DAbort_TLBConflict
result<4:0> = '10000';
when DAbort_Lockdown
result<4:0> = '10100';
when DAbort_Coproc
result<4:0> = '11010';
when DAbort_ICacheMaint
result<4:0> = '00100';
otherwise
result<4:0> = bits(5) UNKNOWN;
B2-1302 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
return result;
For a VMSA implementation, the EncodeLDFSR() pseudocode function returns the required fault code for a fault
status register that is reporting a Data Abort when using the Long-descriptor translation table format:
// EncodeLDFSR()
// =============
// Function that gives the Long-descriptor FSR code for
// different types of Data Abort
bits(6) result;
case type of
when DAbort_AccessFlag
result<5:2> = '0010';
result<1:0> = level<1:0>;
when DAbort_Alignment
result<5:0> = '100001';
when DAbort_Permission
result<5:2> = '0011';
result<1:0> = level<1:0>;
when DAbort_Translation
result<5:2> = '0001';
result<1:0> = level<1:0>;
when DAbort_SyncExternal
result<5:0> = '010000';
when DAbort_SyncExternalonWalk
result<5:2> = '0101';
result<1:0> = level<1:0>;
when DAbort_SyncParity
result<5:0> = '011000';
when DAbort_SyncParityonWalk
result<5:2> = '0111';
result<1:0> = level<1:0>;
when DAbort_AsyncParity
result<5:0> = '011001';
when DAbort_AsyncExternal
result<5:0> = '010001';
when DAbort_SyncWatchpoint, DAbort_AsyncWatchpoint
result<5:0> = '100010';
when DAbort_TLBConflict
result<5:0> = '110000';
when DAbort_Lockdown
result<5:0> = '110100';
when DAbort_Coproc
result<5:0> = '111010';
otherwise
result<5:0> = bits(6) UNKNOWN;
return result;
For a PMSA implementation, the EncodePMSAFSR() pseudocode function returns the required fault code for a fault
status register that is reporting a Data Abort:
// EncodePMSAFSR()
// ===============
// Function that gives the PMSA FSR code for
// different types of Data Abort
bits(5) result;
case type of
when DAbort_Alignment
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B2-1303
ID040418 Non-Confidential
B2 Common Memory System Architecture Features
B2.4 Pseudocode details of general memory system operations
result<4:0> = '00001';
when DAbort_Permission
result<4:0> = '01101';
when DAbort_SyncExternal
result<4:0> = '01000';
when DAbort_SyncParity
result<4:0> = '11001';
when DAbort_AsyncParity
result<4:0> = '11000';
when DAbort_AsyncExternal
result<4:0> = '10110';
when DAbort_SyncWatchpoint, DAbort_AsyncWatchpoint
result<4:0> = '00010';
when DAbort_Background
result<4:0> = '00000';
when DAbort_Lockdown
result<4:0> = '10100';
when DAbort_Coproc
result<4:0> = '11010';
otherwise
result<4:0> = bits(5) UNKNOWN;
return result;
B2-1304 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter B3
Virtual Memory System Architecture (VMSA)
This chapter provides a system level view of the Virtual Memory System Architecture (VMSA), the memory system
architecture of an ARMv7-A implementation. It contains the following sections:
• About the VMSA on page B3-1306.
• The effects of disabling MMUs on VMSA behavior on page B3-1312.
• Translation tables on page B3-1316.
• Secure and Non-secure address spaces on page B3-1320.
• Short-descriptor translation table format on page B3-1321.
• Long-descriptor translation table format on page B3-1334.
• Memory access control on page B3-1352.
• Memory region attributes on page B3-1362.
• Translation Lookaside Buffers (TLBs) on page B3-1374.
• TLB maintenance requirements on page B3-1377.
• Caches in a VMSA implementation on page B3-1389.
• VMSA memory aborts on page B3-1392.
• Exception reporting in a VMSA implementation on page B3-1406.
• Virtual Address to Physical Address translation operations on page B3-1434.
• About the system control registers for VMSA on page B3-1440.
• Organization of the CP14 registers in a VMSA implementation on page B3-1464.
• Organization of the CP15 registers in a VMSA implementation on page B3-1465.
• Functional grouping of VMSAv7 system control registers on page B3-1486.
• Pseudocode details of VMSA memory system operations on page B3-1498.
Note
For an ARMv7-A implementation, this chapter must be read with Chapter B2 Common Memory System
Architecture Features.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1305
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.1 About the VMSA
• For details of the VMSA differences in previous versions of the ARM architecture, see:
— VMSA support on page D12-2506 for ARMv6.
— Virtual memory support on page D15-2590 for the ARMv4 and ARMv5 architectures.
In VMSAv7, a Memory Management Unit (MMU) controls address translation, access permissions, and memory
attribute determination and checking, for memory accesses made by the processor. The MMU is controlled by
system control registers, that can also disable the MMU. This chapter includes a definition the behavior of the
memory system when the MMU is disabled.
The Extended VMSAv7 provides multiple stages of memory system control, as follows:
• For operation in Secure state, a single stage of memory system control.
• For operation in Non-secure state, up to two stages of memory system control:
— When executing at PL2, a single stage of memory system control.
— When executing at PL1 or PL0, two stages of memory system control.
Each supported stage of memory system control is provided by an MMU, with its own independent set of controls.
Therefore, the Extended VMSAv7 provides the following MMUs:
• Secure PL1&0 stage 1 MMU.
• Non-secure PL2 stage 1 MMU.
• Non-secure PL1&0 stage 1 MMU.
• Non-secure PL1&0 stage 2 MMU.
Note
The model of having a separate MMU for each stage of memory control is an architectural abstraction. It does not
indicate any specific hardware requirements for an Extended VMSAv7 processor implementation. The architecture
requires only that the behavior of any VMSAv7 processor matches the behavior described in this manual.
These features mean the Extended VMSAv7 can support a hierarchy of software supervision, for example an
Operating System and a hypervisor.
Each MMU uses a set of address translations and associated memory properties held in memory mapped tables
called translation tables.
If an implementation does not include the Security Extensions, it has only a single Security state, with a single MMU
with controls equivalent to the Secure state MMU controls.
B3-1306 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.1 About the VMSA
Note
In the ARMv7 architecture, a software agent, such as an Operating System, that uses or defines stage
1 memory translations, might be unaware of the distinction between IPA and PA.
Translation regime
Secure PL1&0 stage 1 MMU
Secure PL1&0 VA PA, Secure or Non-secure
Non-secure PL1&0 VA Non-secure PL1&0 IPA Non-secure PL1&0 PA, Non-secure only
stage 1 MMU stage 2 MMU
Note
Conceptually, a translation regime that has only a stage 1 MMU is equivalent to a regime with a fixed, flat stage 2
mapping from IPA to PA.
System Control coprocessor (CP15) registers control the VMSA, including defining the location of the translation
tables, and enabling and configuring the MMUs. Also, they report any faults that occur on a memory access. For
more information, see Functional grouping of VMSAv7 system control registers on page B3-1486.
The following sections give an overview of the VMSA, and of the implementation options for VMSAv7:
• Address types used in a VMSA description on page B3-1308.
• Address spaces in a VMSA implementation on page B3-1308.
• About address translation on page B3-1309.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1307
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.1 About the VMSA
The remainder of the chapter fully describes the VMSA, including the different implementation options, as
summarized in Organization of this chapter on page B3-1311.
Note
These descriptions relate to a VMSAv7 description and therefore sometimes differ from the generic definitions
given in the Glossary.
Note
Appendix D10 Fast Context Switch Extension (FCSE) describes the FCSE. From ARMv6, ARM
deprecates any use of the FCSE. The FCSE is:
• OPTIONAL and deprecated in an ARMv7 implementation that does not include the
Multiprocessing Extensions.
• Obsolete from the introduction of the Multiprocessing Extensions.
• An IPA address space of up to 40 bits. The translation tables and associated system control registers define
the width of the implemented address space.
B3-1308 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.1 About the VMSA
Note
The Large Physical Address Extension defines two translation table formats. The Long-descriptor format gives
access to the full 40-bit IPA or PA address space at a granularity of 4KB. The Short-descriptor format:
• Gives access to a 32-bit PA address space at 4KB granularity.
• Optionally, gives access to a 40-bit PA address space, but only at 16MB granularity.
If an implementation includes the Security Extensions, the address maps are defined independently for Secure and
Non-secure operation, providing two independent 40-bit address spaces, where:
• A VA accessed from Non-secure state can only be translated to the Non-secure address map.
• A VA accessed from Secure state can be translated to either the Secure or the Non-secure address map.
• One table defines the mapping for operating system and I/O addresses, that do not change on a context switch.
• A second table defines the mapping for application-specific addresses, and therefore might require updating
on a context switch.
The VMSAv7 implementation options determine the supported MMUs, and therefore the supported address
translations:
VMSAv7 with the Security Extensions but without the Virtualization Extensions
Supports only the Secure PL1&0 stage 1 MMU and the Non-secure PL1&0 stage 1 MMU.
Operation of each of these MMUs can be split between two sets of translation tables, which are
defined by the Secure and Non-secure copies of TTBR0 and TTBR1, and controlled by the Secure
and Non-secure copies of TTBCR.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1309
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.1 About the VMSA
Translation regime
Secure PL1&0 stage 1 MMU PA,
Secure PL1&0 VA
Secure TTBR0‡, TTBR1‡, and TTBCR‡ Secure or Non-secure
In general:
• The translation from VA to PA can require multiple stages of address translation, as Figure B3-2 shows.
• A single stage of address translation takes an input address and translates it to an output address.
A full translation table lookup is called a translation table walk. It is performed automatically by hardware, and can
have a significant cost in execution time. To support fine granularity of the VA to PA mapping, a single input address
to output address translation can require multiple accesses to the translation tables, with each access giving finer
granularity. Each access is described as a level of address lookup. The final level of the lookup defines:
• The required output address.
• The attributes and access permissions of the addressed memory.
Translation Lookaside Buffers (TLBs) reduce the average cost of a memory access by caching the results of
translation table walks. TLBs behave as caches of the translation table information, and the VMSA provides TLB
maintenance operations for the management of TLB contents.
Note
The ARM architecture permits TLBs to hold any translation table entry that does not directly cause a Translation
fault or an Access flag fault.
To reduce the software overhead of TLB maintenance, the VMSA distinguishes between Global pages and
Process-specific pages. The Address Space Identifier (ASID) identifies pages associated with a specific process and
provides a mechanism for changing process-specific tables without having to maintain the TLB structures.
If an implementation includes the Virtualization Extensions, the virtual machine identifier (VMID) identifies the
current virtual machine, with its own independent ASID space. The TLB entries include this VMID information,
meaning TLBs do not require explicit invalidation when changing from one virtual machine to another, if the virtual
machines have different VMIDs. For stage 2 translations, all translations are associated with the current VMID, and
there is no concept of global entries.
B3-1310 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.1 About the VMSA
The first part of the chapter describes address translation and the associated memory properties held in the
translation table entries, in the following sections:
• The effects of disabling MMUs on VMSA behavior on page B3-1312.
• Translation tables on page B3-1316.
• Secure and Non-secure address spaces on page B3-1320.
• Short-descriptor translation table format on page B3-1321.
• Long-descriptor translation table format on page B3-1334.
• Memory access control on page B3-1352.
• Memory region attributes on page B3-1362.
• Translation Lookaside Buffers (TLBs) on page B3-1374.
• TLB maintenance requirements on page B3-1377.
The following sections describe aborts on VMSA memory accesses, and how these and other faults are reported in
a VMSA implementation:
• VMSA memory aborts on page B3-1392.
• Exception reporting in a VMSA implementation on page B3-1406.
Virtual Address to Physical Address translation operations on page B3-1434 describes these operations, and how
they relate to address translation.
A number of sections then describe the control registers in a VMSA implementation. The following sections give
general information about the control registers, and the organization of the registers in the two coprocessors, CP14
and CP15, that provide the interface to these registers:
• About the system control registers for VMSA on page B3-1440.
• Organization of the CP14 registers in a VMSA implementation on page B3-1464.
• Organization of the CP15 registers in a VMSA implementation on page B3-1465.
• Functional grouping of VMSAv7 system control registers on page B3-1486.
The following sections then describe each of the functional groups of CP15 registers, including a full description of
each register in the group:
• Identification registers, functional group on page B3-1487.
• Virtual memory control registers, functional group on page B3-1488.
• PL1 Fault handling registers, functional group on page B3-1489.
• Other system control registers, functional group on page B3-1489.
• Lockdown, DMA, and TCM features, functional group, VMSA on page B3-1490.
• Cache maintenance operations, functional group, VMSA on page B3-1491.
• TLB maintenance operations, functional group on page B3-1492.
• Address translation operations, functional group on page B3-1493.
• Miscellaneous operations, functional group on page B3-1494.
• Performance Monitors, functional group on page B3-1495.
• Security Extensions registers, functional group on page B3-1495.
• Virtualization Extensions registers, functional group on page B3-1496.
• IMPLEMENTATION DEFINED registers, functional group on page B3-1497.
Pseudocode details of VMSA memory system operations on page B3-1498 then describes many features of VMSA
operation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1311
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.2 The effects of disabling MMUs on VMSA behavior
The following sections describe the effect on VMSAv7 behavior of disabling each stage of translation:
• VMSA behavior when a stage 1 MMU is disabled.
• VMSA behavior when the stage 2 MMU is disabled on page B3-1314.
• Behavior of instruction fetches when all associated MMUs are disabled on page B3-1314.
Enabling MMUs on page B3-1314 gives information about enabling MMUs, in particular after a reset on an
implementation that includes the Security Extensions.
Non-secure PL1 and PL0 accesses when HCR.DC is set to 1, Virtualization Extensions
In an implementation that includes the Virtualization Extensions, for an access from a Non-secure
PL1 or PL0 mode when HCR.DC is set to 1, the stage 1 translation assigns the Normal
Non-shareable, Inner Write-Back Write-Allocate, Outer Write-Back Write-Allocate memory
attributes.
Instruction access
The stage 1 translation assigns Normal memory attribute, with the cacheability and
shareability attributes determined by the value of:
• The Secure copy of SCTLR.I for the Secure PL1&0 translation regime.
• The Non-secure copy of SCTLR.I for the Non-secure PL1&0 translation regime.
• HSCTLR.I for the Non-secure PL2 translation regime.
In these cases, the meaning of the I bit is as follows:
When I is set to 0
The stage 1 translation assigns the Non-cacheable attribute. If the
implementation includes the Large Physical Address Extension, the Outer
Shareable attribute is assigned, otherwise the shareability attribute is
IMPLEMENTATION DEFINED.
When I is set to 1
The stage 1 translation assigns the Cacheable, Inner Write-Through no
Write-Allocate, Outer Write-Through no Write-Allocate attribute.
B3-1312 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.2 The effects of disabling MMUs on VMSA behavior
Note
• An implementation that includes the Virtualization Extensions must include the
Large Physical Address Extension, and therefore if the stage 1 MMU is disabled
and HSCTLR.I is set to 0, the Outer Shareable attribute is assigned.
• On some implementations, if the SCTLR.TRE bit is set to 0 then this behavior
can be changed by the remap settings in the memory remap registers, see VMSA
CP15 c10 register summary, memory remapping and TLB control registers on
page B3-1473. The details of TEX remap when SCTLR.TRE is set to 0 are
IMPLEMENTATION DEFINED, see SCTLR.TRE, SCTLR.M, and the effect of the
TEX remap registers on page B3-1367.
For this stage of translation, no memory access permission checks are performed, and therefore no MMU faults
relating to this stage of translation can be generated.
Note
Alignment checking is performed, and therefore Alignment faults can occur.
For every access, the output address of the stage 1 translation is equal to the input address. This is called a flat
address mapping. If the implementation supports output addresses of more than 32 bits then the output address bits
above bit[31] are zero. For example, for a VA to PA translation on an implementation that supports 40-bit PAs,
PA[39:32] is 0x00.
If stage 1 translation is disabled for a Secure translation regime, every access in Secure state using that translation
regime is made to the Secure physical address space.
If stage 1 translation is disabled for a Non-secure translation regime, every access in Non-secure state using that
translation regime is made to the Non-secure physical address space.
For a Non-secure PL1 or PL0 access, if the PL1&0 stage 2 MMU is enabled, the stage 1 memory attribute
assignments and output address can be modified by the stage 2 translation.
The effect of executing in a Non-secure PL1 or PL0 mode with HCR.DC set to 1 is UNPREDICTABLE if one or more
of the following applies:
• The Non-secure SCTLR.M bit is set to 1, enabling the Non-secure PL1&0 stage 1 MMU.
• The HCR.VM bit is set to 0, disabling the Non-secure PL1&0 stage 2 MMU.
The effect of HCR.DC might be held in TLB entries associated with a particular VMID. Therefore, if software
executing at PL2 changes the HCR.DC value without also changing the current VMID, it must also invalidate all
TLB entries associated with the current VMID. Otherwise, the behavior of Non-secure software executing at PL1
or PL0 is UNPREDICTABLE.
See also Behavior of instruction fetches when all associated MMUs are disabled on page B3-1314.
CP15 TLB invalidate operations act on the target TLB whether the MMU is enabled or not.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1313
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.2 The effects of disabling MMUs on VMSA behavior
When the Non-secure PL1&0 stage 1 MMU is disabled, any ATS1C** or ATS12NSO** address translation
operation that accesses the Non-secure state translation reflects the effect of the HCR.DC bit. For more information
about these operations, see Virtual Address to Physical Address translation operations on page B3-1434.
If the stage 1 MMU and the stage 2 MMU are both disabled, see Behavior of instruction fetches when all associated
MMUs are disabled.
B3.2.3 Behavior of instruction fetches when all associated MMUs are disabled
The information in this section applies to memory accesses:
• From Secure PL1 and PL0 modes, when the Secure PL1&0 stage 1 MMU is disabled.
• From the Non-secure PL2 mode, when the Non-secure PL2 stage 1 MMU is disabled.
• From Non-secure PL1 and PL0 modes, when all of the following apply:
— The Non-secure PL1&0 stage 1 MMU is disabled.
— The Non-secure PL1&0 stage 2 MMU is disabled.
— HCR.DC is set to 0.
In these cases, a memory location might be accessed as a result of an instruction fetch if one of the following
conditions is met:
• The memory location is in the same 4KB block of memory (aligned to 4KB) as an instruction that a simple
sequential execution of the program requires to be fetched, or is in the 4KB block of memory immediately
following such a block.
• The memory location is in the same 4KB block of memory (aligned to 4KB) from which a simple sequential
execution of the program with all associated MMUs disabled has previously required an instruction to be
fetched, or is in the 4KB block immediately following such a block.
These accesses can be caused by speculative instruction fetches, regardless of whether the prefetched instruction is
committed for execution.
Note
To ensure architectural compliance, software must ensure that both of the following apply:
• Instructions that will be executed when an MMU is disabled are located in 4KB blocks of the address space
that contain only memory that is tolerant to speculative accesses.
• Each 4KB block of the address space that immediately follows a 4KB block that holds instructions that will
be executed when an MMU is disabled also contains only memory which is tolerant to speculative accesses.
• The PL1&0 stage 1 MMU enable bit, SCTLR.M, is Banked, meaning there are separate enables for operation
in Secure and Non-secure state.
• On startup or reset, only the Secure copy of the SCTLR.M bit resets to 0, disabling the Secure state PL1&0
stage 1 MMU. The reset value of the Non-secure copy of SCTLR.M is UNKNOWN.
B3-1314 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.2 The effects of disabling MMUs on VMSA behavior
In an implementation that includes the Virtualization Extensions, on startup or reset, the HSCTLR.M bit, that
controls the Non-secure PL2 stage 1 MMU, is UNKNOWN.
Note
If the PA of the software that enables or disables an MMU differs from its VA, speculative instruction fetching can
cause complications. ARM strongly recommends that the PA and VA of any software that enables or disables an
MMU are identical if that MMU controls address translations that apply to the software currently being executed.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1315
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.3 Translation tables
Short-descriptor format
This is the original format defined in issue A of this Architecture Reference Manual, and is the only
format supported on implementations that do not include the Large Physical Address Extension. It
uses 32-bit descriptor entries in the translation tables, and provides:
• Up to two levels of address lookup.
• 32-bit input addresses.
• Output addresses of up to 40 bits.
• Support for PAs of more than 32 bits by use of supersections, with 16MB granularity.
• Support for No access, Client, and Manager domains.
• 32-bit table entries.
Long-descriptor format
The Large Physical Address Extension adds support for this format. It uses 64-bit descriptor entries
in the translation tables, and provides:
• Up to three levels of address lookup.
• Input addresses of up to 40 bits, when used for stage 2 translations.
• Output addresses of up to 40 bits.
• 4KB assignment granularity across the entire PA range.
• No support for domains, all memory regions are treated as in a Client domain.
• 64-bit table entries.
• Fixed 4KB table size, unless truncated by the size of the input address space.
Note
Translation with a 40-bit input address range requires two concatenated 4KB top-level tables,
aligned to 8KB.
The Large Physical Address Extension is an OPTIONAL extension, but an implementation that includes the
Virtualization Extensions must also include the Large Physical Address Extension.
In an implementation that includes the Large Physical Address Extension, but not the Virtualization Extensions, the
TTBCR.EAE bit indicates the current translation table format.
In an implementation that includes the Virtualization Extensions, of the possible address translations shown in
Figure B3-2 on page B3-1310:
• The translation tables for the Secure PL1&0 stage 1 translations, and for the Non-secure PL1&0 stage 1
translations, can use either translation table format, and the TTBCR.EAE bit indicates the current translation
table format.
• The translation tables for the Non-secure PL2 stage 1 translations, and for the Non-secure PL1&0 stage 2
translations, must use the Long-descriptor translation table format.
Many aspects of performing a translation table walk depend on the current translation table format. Therefore, the
following sections describe the two formats, including how the MMU performs a translation table walk for each
format:
• Short-descriptor translation table format on page B3-1321.
• Long-descriptor translation table format on page B3-1334.
The following subsections describe aspects of the translation tables and translation table walks that are independent
of the translation table format:
• Translation table walks on page B3-1317.
• Information returned by a translation table lookup on page B3-1318.
• Determining the translation table base address on page B3-1318.
• Security Extensions control of translation table walks on page B3-1319.
B3-1316 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.3 Translation tables
Note
When using the Short-descriptor translation table format, the starting level for a translation table walk is always a
first-level lookup. However, with the Long-descriptor translation table format, the starting-level can be either a
first-level or a second-level lookup.
For the PL1&0 stage 1 translations, SCTLR.EE determines the endianness of the translation table lookups. In an
implementation that includes the Security Extensions, SCTLR is Banked, and therefore the endianness is
determined independently for the Secure and Non-secure PL1&0 stage 1 translations.
If an implementation includes the Virtualization Extensions, HSCTLR.EE defines the endianness for the
Non-secure PL2 stage 1 and Non-secure PL1&0 stage 2 translations.
Note
Dynamically changing translation table endianness
Because any change to SCTLR.EE or HSCTLR.EE requires synchronization before it is visible to
subsequent operations, ARM strongly recommends that:
• SCTLR.EE is changed only when either:
— Executing in a mode that does not use the translation tables affected by SCTLR.EE.
— Executing with SCTLR.M set to 0.
• HSCTLR.EE is changed only when either:
— Executing in a mode that does not use the translation tables affected by HSCTLR.EE.
— Executing with HSCTLR.M set to 0.
The physical address of the base of the starting-level translation table is determined from the appropriate Translation
table base register, see Determining the translation table base address on page B3-1318.
In an ARMv7 implementation that does not include the Multiprocessing Extensions, and in implementations of
architecture versions before ARMv7, it is IMPLEMENTATION DEFINED whether a hardware translation table walk can
cause a read from the L1 unified or data cache. If an implementation does not support translation table accesses from
L1 cache, then software must ensure coherency between translation table walks and data updates. This involves one
of:
• Storing translation tables in Normal memory that is Write-Through Cacheable for all cacheability regions to
the PoU.
• Storing translation tables in Inner Write-Back Cacheable Normal memory and ensuring the appropriate cache
entries are cleaned after modification.
For more information, see TLB maintenance operations and the memory order model on page B3-1379.
If an implementation includes the Multiprocessing Extensions, translation table walks must access data or unified
caches, or data and unified caches, of other agents participating in the coherency protocol, according to the
shareability attributes described in the TTBR. These shareability attributes must be consistent with the shareability
attributes for the translation tables themselves.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1317
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.3 Translation tables
The returned properties are classified as providing address map control, access controls, or region attributes. This
classification determines how the descriptions of the properties are grouped. The classification is based on the
following model:
Access controls
Determine whether the processor, in its current state, can access the output address that corresponds
to the given input address. If not, an MMU fault is generated and there is no memory access.
Memory access control on page B3-1352 describes the properties in this group.
Attributes Are valid only for an output address that the processor, in its current state, can access. The attributes
define aspects of the required behavior of accesses to the target memory region.
Memory region attributes on page B3-1362 describes the properties in this group.
• For a Non-secure PL2 stage 1 translation, the HTTBR holds the required base address. The HTCR is the
control register for these translations.
• For a Non-secure PL1&0 stage 2 translation, the VTTBR holds the required base address. The VTCR is the
control register for these translations.
• For a Non-secure PL1&0 stage 1 translation, or for a Secure PL1&0 stage 1 translation, either TTBR0 or
TTBR1 holds the required base address. The TTBCR is the control register for these translations.
The Non-secure copies of TTBR0, TTBR1, and TTBCR, relate to the Non-secure PL1&0 stage 1 translation.
The Secure copies of TTBR0, TTBR1, and TTBCR, relate to the Secure PL1&0 stage 1 translation.
• TTBR0 can be configured to describe the translation of VAs in the entire address map, or to describe only the
translation of VAs in the lower part of the address map.
• If TTBR0 is configured to describe the translation of VAs in the lower part of the address map, TTBR1 is
configured to describe the translation of VAs in the upper part of the address map.
The contents of the appropriate copy of the TTBCR determine whether the address map is separated into two parts,
and where the separation occurs. The details of the separation depend on the current translation table format, see:
• Selecting between TTBR0 and TTBR1, Short-descriptor translation table format on page B3-1327.
• Selecting between TTBR0 and TTBR1, Long-descriptor translation table format on page B3-1341.
B3-1318 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.3 Translation tables
TTBR1 Used for operating system and I/O addresses, that do not change on a context switch.
Note
The different bit names are because the bits are in different positions in TTBCR, depending on the translation table
format.
{E}PDx == 0 If a TLB miss occurs based on TTBRx, a translation table walk is performed. The current security
state determines whether the memory access is Secure or Non-secure.
{E}PDx == 1 If a TLB miss occurs based on TTBRx, a First level Translation fault is returned, and no translation
table walk is performed.
• In the Secure translation tables, the NS bit in a descriptor indicates whether the descriptor refers to the Secure
or the Non-secure address map:
NS == 0 Access the Secure physical address space.
NS == 1 Access the Non-secure physical address space.
• In the Non-secure translation tables, the corresponding bit is SBZ. Non-secure accesses always access the
Non-secure physical address space, regardless of the value of this bit.
The Long-descriptor translation table format extends this control, adding an NSTable bit to the Secure translation
tables, as described in Hierarchical control of Secure or Non-secure memory accesses, Long-descriptor format on
page B3-1340. In the Non-secure translation tables, the corresponding bit is SBZ, and Non-secure accesses ignore
the value of this bit.
The following sections describe the address map controls in the two implementations:
• Control of Secure or Non-secure memory access, Short-descriptor format on page B3-1326.
• Control of Secure or Non-secure memory access, Long-descriptor format on page B3-1340.
For more information, see Secure and Non-secure address spaces on page B3-1320.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1319
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.4 Secure and Non-secure address spaces
As described in Access to the Secure or Non-secure physical address map on page B3-1319, for Secure and
Non-secure PL1&0 stage 1 translations, the Translation table base registers, TTBR0, TTBR1, and TTBCR are
Banked between Secure and Non-secure versions, and the Security state of the processor when it performs a
memory access selects the corresponding version of the registers. This means there are independent Secure and
Non-secure versions of these translation tables, and translation table walks are made to the physical address space
corresponding to the Security state of the translation tables used.
For a translation table walk caused by a memory access from Non-secure state, all memory accesses are to the
Non-secure address space.
For a translation table walk caused by a memory access from Secure state:
• In an implementation that includes the Large Physical Address Extension, when address translation is using
the Long-descriptor translation table format:
— The first lookup performed must access the Secure address space.
— If a table descriptor read from the Secure address space has the NSTable bit set to 0, then the next level
of lookup is from the Secure address space.
— If a table descriptor read from the Secure address space has the NSTable bit set to 1, then the next level
of lookup, and any subsequent level of lookup, is from the Non-secure address space.
For more information, see Control of Secure or Non-secure memory access, Long-descriptor format on
page B3-1340.
Note
• An ARMv7 implementation that includes the Virtualization Extensions, when executing in Non-secure state,
supports additional translations:
— Non-secure PL2 stage 1 translation.
— Non-secure PL1&0 stage 2 translation.
These translations can access only the Non-secure address space.
• A system implementation can alias parts of the Secure physical address space to the Non-secure physical
address space in an implementation-specific way. As with any other aliasing of physical memory, the use of
aliases in this way can require the use of cache maintenance operations to ensure that changes to memory
made using one alias of the physical memory are visible to accesses to the other alias of the physical memory.
B3-1320 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
Supersections Consist of 16MB blocks of memory. Support for Supersections is optional, except that an
implementation that includes the Large Physical Address Extension and supports more that 32 bits
of Physical Address must also support Supersections to provide access to the entire Physical
Address space.
Supersections, Sections and Large pages map large regions of memory using only a single TLB entry.
Note
Whether a VMSAv7 implementation of the Short-descriptor format translation tables supports supersections is
IMPLEMENTATION DEFINED.
When using the Short-descriptor translation table format, two levels of translation tables are held in memory:
First-level table
Holds first-level descriptors that contain the base address and
• Translation properties for a Section and Supersection.
• Translation properties and pointers to a second-level table for a Large page or a Small page.
Second-level tables
Hold second-level descriptors that contain the base address and translation properties for a Small
page or a Large page. With the Short-descriptor format, second-level tables can be referred to as
Page tables.
A second-level table requires 1KByte of memory.
Bits[1:0] of the descriptor give the primary indication of the descriptor type.
Figure B3-3 on page B3-1322 gives a general view of address translation when using the Short-descriptor
translation table format.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1321
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
First-level table
TTBR0 or TTBR1
Second-level table
1MB
Section memory
region 64KB
Large page memory
Page table page
Repeated
16 times†
16MB Large page
Indexed by
Supersection memory
VA[31-N:20]‡ Indexed by
Repeated region
VA[19:12]
16 times†
Supersection 4KB
Small page memory
page
Figure B3-3 General view of address translation using Short-descriptor format translation tables
Additional requirements for Short-descriptor format translation tables on page B3-1325 describes why, when using
the Short-descriptor format, Supersection and Large page entries must be repeated 16 times, as shown in
Figure B3-3.
Short-descriptor translation table format descriptors, Memory attributes in the Short-descriptor translation table
format descriptors on page B3-1325, and Control of Secure or Non-secure memory access, Short-descriptor format
on page B3-1326 describe the format of the descriptors in the Short-descriptor format translation tables.
The following sections then describe the use of this translation table format:
• Selecting between TTBR0 and TTBR1, Short-descriptor translation table format on page B3-1327.
• Translation table walks, when using the Short-descriptor translation table format on page B3-1328.
For more information about second-level translation tables, see Additional requirements for Short-descriptor format
translation tables on page B3-1325.
Note
Previous versions of the ARM Architecture Reference Manual, and some other documentation, describes the AP[2]
bit in the translation table entries as the APX bit.
Information returned by a translation table lookup on page B3-1318 describes the classification of the non-address
fields in the descriptors as address map control, access control, or attribute fields.
Figure B3-4 on page B3-1323 shows the possible first-level descriptor formats.
B3-1322 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
31 2 1 0
Invalid IGNORED 0 0
31 10 9 8 5 4 3 2 1 0
Page table Page table base address, bits[31:10] Domain 0 1
31 20 19 18 17 16 15 14 12 11 10 9 8 5 4 3 2 1 0
Section Section base address, PA[31:20] 0 S Domain C B 1
NS nG XN PXN‡
AP[2]
TEX[2:0]
AP[1:0]
IMPLEMENTATION DEFINED
31 24 23 20 19 18 17 16 15 14 12 11 10 9 8 5 4 3 2 1 0
Supersection 1 S TEX[2:0] C B 1
31 2 1 0
Reserved, when Large
Physical Address Extension Reserved, UNK/SBZP 1 1
not implemented
† If the implementation does not support the PXN attribute this bit is SBZ. An implementation that includes the Large Physical
‡ If the implementation does not support the PXN attribute these bits must be 0. Address Extension must support the PXN attribute.
Inclusion of the PXN attribute in the Short-descriptor translation table formats is:
• OPTIONAL in an implementation that does not include the Large Physical Address Extension.
• Required in an implementation includes the Large Physical Address Extension.
Descriptor bits[1:0] identify the descriptor type. On an implementation that supports the PXN attribute, for the
Section and Supersection entries, bit[0] also defines the PXN value. The encoding of these bits is:
0b00, Invalid
The associated VA is unmapped, and any attempt to access it generates a Translation fault.
Software can use bits[31:2] of the descriptor for its own purposes, because the hardware ignores
these bits.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1323
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
0b11, Reserved, UNK/SBZP, if the implementation does not support the PXN attribute
An attempt to access the associated VA generates a Translation fault.
On an implementation that does not support the PXN attribute, this encoding must not be used.
Note
• Issues A and B of this manual did not include the OPTIONAL support of the PXN attribute. The addition of
support for this attribute is backwards-compatible with software written to use the original VMSAv7
definition of the Short-descriptor translation table formats.
• A VMSAv7 implementation that implements the Large Physical Address Extension can use the
Short-descriptor translation table format for the Secure or Non-secure PL1&0 stage 1 translations, by setting
TTBCR.EAE to 0.
On an implementation that includes the Virtualization Extensions, for the Non-secure translation tables, the address
in the descriptor is the IPA of the Page table, Section, or Supersection. Otherwise, the address is the PA of the Page
table, Section, or Supersection.
For descriptions of the other fields in the descriptors, see Memory attributes in the Short-descriptor translation table
format descriptors on page B3-1325.
31 2 1 0
Invalid IGNORED 0 0
31 16 15 14 12 11 10 9 8 6 5 4 3 2 1 0
Large page Large page base address, PA[31:16] TEX[2:0] S SBZ C B 0 1
XN nG AP[1:0]
AP[2]
31 12 11 10 9 8 6 5 4 3 2 1 0
Small page Small page base address, PA[31:12] S TEX[2:0] C B 1
nG AP[1:0] XN
AP[2]
Descriptor bits[1:0] identify the descriptor type. The encoding of these bits is:
0b00, Invalid
The associated VA is unmapped, and attempting to access it generates a Translation fault.
Software can use bits[31:2] of the descriptor for its own purposes, because the hardware ignores
these bits.
B3-1324 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
On an implementation that includes the Virtualization Extensions, for the Non-secure translation tables, the address
in the descriptor is the IPA of the Page table, Section, or Supersection. Otherwise, the address is the PA of the Page
table, Section, or Supersection.
For descriptions of the other fields in the descriptors, see Memory attributes in the Short-descriptor translation table
format descriptors.
Considering the case of using Large page table descriptors in a second-level translation table, this overlap means
that for any specific Large page, the bottom four bits of the second-level translation table entry might take any value
from 0b0000 to 0b1111. Therefore, each of these 16 index values must point to a separate copy of the same descriptor.
This means that each Large page or Supersection descriptor must:
• Occur first on a sixteen-word boundary.
• Be repeated in 16 consecutive memory locations.
TEX[2:0], C, B
Memory region attribute bits, see Memory region attributes on page B3-1362.
These bits are not present in a Page table entry.
XN bit The Execute-never bit. Determines whether the processor can execute software from the addressed
region, see Execute-never restrictions on instruction fetching on page B3-1355.
This bit is not present in a Page table entry.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1325
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
Note
Memory accesses by software executing at PL2 always use the Long-descriptor translation table
format.
When this bit is set to 1 in the Page table descriptor, it indicates that all memory pages described in
the corresponding page table are Privileged execute-never.
NS bit Non-secure bit. If an implementation includes the Security Extensions, for memory accesses from
Secure state, this bit specifies whether the translated PA is in the Secure or Non-secure address map,
see Control of Secure or Non-secure memory access, Short-descriptor format.
This bit is not present in second-level descriptors. The value of the NS bit in the first level Page table
descriptor applies to all entries in the corresponding second-level translation table.
Domain Domain field, see Domains, Short-descriptor format only on page B3-1358.
This field is not present in a Supersection entry. Memory described by Supersections is in domain 0.
This bit is not present in second-level descriptors. The value of the Domain field in the first level
Page table descriptor applies to all entries in the corresponding second-level translation table.
AP[2], AP[1:0]
Access Permissions bits, see Memory access control on page B3-1352.
AP[0] can be configured as the Access flag, see The Access flag on page B3-1358.
These bits are not present in a Page table entry.
S bit The Shareable bit. Determines whether the addressed region is Shareable memory, see Memory
region attributes on page B3-1362.
This bit is not present in a Page table entry.
nG bit The not global bit. Determines how the translation is marked in the TLB, see Global and
process-specific translation table entries on page B3-1374.
This bit is not present in a Page table entry.
In the Short-descriptor translation table format, the NS bit is defined only in the first-level translation tables. This
means that, in a first-level Page table descriptor, the NS bit defines the physical address space, Secure or
Non-secure, for all of the Large pages and Small pages of memory described by that table.
The NS bit of a first-level Page table descriptor has no effect on the physical address space in which that translation
table is held. As stated in Secure and Non-secure address spaces on page B3-1320, the physical address of that
translation table is in:
• The Secure address space if the translation table walk is in Secure state.
• The Non-secure address space if the translation table walk is in Non-secure state.
This means the granularity of the Secure and Non-secure memory spaces is 1MB. However, in these memory
spaces, table entries can define physical memory regions with a granularity of 4KB.
B3-1326 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
B3.5.4 Selecting between TTBR0 and TTBR1, Short-descriptor translation table format
As described in Determining the translation table base address on page B3-1318, two sets of translation tables can
be defined for each of the PL1&0 stage 1 translations, and TTBR0 and TTBR1 hold the base addresses for the two
sets of tables. When using the Short-descriptor translation table format, the value of TTBCR.N indicates the number
of most significant bits of the input VA that determine whether TTBR0 or TTBR1 holds the required translation
table base address, as follows:
• If N == 0 then use TTBR0. Setting TTBCR.N to zero disables use of a second set of translation tables.
• If N > 0 then:
— If bits[31:32-N] of the input VA are all zero, then use TTBR0.
— Otherwise use TTBR1.
Table B3-1 shows how the value of N determines the lowest address translated using TTBR1, and the size of the
first-level translation table addressed by TTBR0.
TTBR0 table
TTBCR.N First address translated with TTBR1
Size Index range
Whenever TTBCR.N is nonzero, the size of the translation table addressed by TTBR1 is 16KB.
Figure B3-6 on page B3-1328 shows how the value of TTBCR.N controls the boundary between VAs that are
translated using TTBR0, and VAs that are translated using TTBR1.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1327
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
0xFFFFFFFF
TTBR1 region
TTBR0 region
Effect of decreasing N
Boundary, when
0x02000000
TTBCR.N==0b111
TTBR0 region
0x00000000
TTBCR.N==0b000
Use of TTBR1 disabled
Figure B3-6 How TTBCR.N controls the boundary between the TTBRs, Short-descriptor format
In the selected TTBR. the following bits define the memory region attributes for the translation table walk:
• The RGN, S, and C bits, in an implementation that does not include the Multiprocessing Extensions.
• The RGN, S, and IRGN[1:0] bits, in an implementation that includes the Multiprocessing Extensions.
For more information, see TTBCR, Translation Table Base Control Register, VMSA on page B4-1716, TTBR0,
Translation Table Base Register 0, VMSA on page B4-1721 and TTBR1, Translation Table Base Register 1, VMSA
on page B4-1725.
Translation table walks, when using the Short-descriptor translation table format describes the translation.
B3.5.5 Translation table walks, when using the Short-descriptor translation table format
When using the Short-descriptor translation table format, and a memory access requires a translation table walk:
• A section-mapped access only requires a read of the first-level translation table.
• A page-mapped access also requires a read of the second-level translation table.
Reading a first-level translation table describes how either TTBR1 or TTBR0 is used, with the accessed VA, to
determine the address of the first-level descriptor.
• On an implementation that includes the Virtualization Extensions, for a Non-secure PL1&0 stage 1
translation, this is the IPA of the required descriptor. A Non-secure PL1&0 stage 2 translation of this address
is performed to obtain the PA of the descriptor.
The full translation flow for Sections, Supersections, Small pages and Large pages on page B3-1329 then shows the
complete translation flow for each valid memory access.
The width of the TTBR0 and VA fields depend on the value of TTBCR.N, as Figure B3-7 on page B3-1329 shows.
B3-1328 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
When performing a fetch based on TTBR1, Bits TTBR1[31:14] are concatenated with bits[31:20] of the VA. This
makes the fetch equivalent to that shown in Figure B3-7, with N==0.
Note
See The address and Properties fields shown in the translation flows on page B3-1330 for more information about
the Properties label used in this and other figures.
31 32-N 31-N 20 19 0
‡ Table index Input address
31 14-N 13-N 7 6 0
UNK/
Translation base Properties TTBR0
SBZP
31 14-N 13-N 2 1 0
A[31:0] of first-level descriptor
Translation base Table index 0 0 Descriptor address
A[39:32] = 0x00
‡ This field is absent if N is 0
N is the value of TTBCR.N
For details of the Properties field, see the register description
Figure B3-7 Accessing first-level translation table based on TTBR0, Short-descriptor format
Regardless of which register is used as the base for the fetch, the resulting output address selects a four-byte
translation table entry that is one of:
• A first-level descriptor for a Section or Supersection.
• A Page table descriptor that points to a second-level translation table. In this case:
— A second fetch is performed to retrieve a second-level descriptor.
— The descriptor also contains some attributes for the access, see Figure B3-4 on page B3-1323.
• A faulting entry.
The full translation flow for Sections, Supersections, Small pages and Large pages
In a translation table walk, only the first lookup uses the translation table base address from the appropriate
Translation table base register. Subsequent lookups use a combination of address information from:
• The table descriptor read in the previous lookup.
• The input address.
This section summarizes how each of the memory section and page options is described in the translation tables,
and has a subsection summarizing the full translation flow for each of the options.
As described in Short-descriptor translation table format descriptors on page B3-1322, the four options are:
Supersection A 16MB memory region, see Translation flow for a Supersection on page B3-1330.
Section A 1MB memory region, see Translation flow for a Section on page B3-1331.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1329
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
On an implementation that includes the Virtualization Extensions, for the Non-secure translation tables:
• Any descriptor address is the IPA of the required descriptor.
• The final output address is the IPA of the Section, Supersection, Large page, or Small page.
In these cases, a PL1&0 stage 2 translation is performed to translate the IPA to the required PA.
Otherwise, the address is the PA of the descriptor, Section, Supersection, Large page, or Small page.
Properties indicates register or translation table fields that return information, other than address information, about
the translation or the targeted memory region. For more information, see Information returned by a translation table
lookup on page B3-1318, and the description of the register or translation table descriptor.
For translations using the Short-descriptor translation table format, Short-descriptor translation table format
descriptors on page B3-1322 describes the descriptors formats.
Figure B3-8 shows the complete translation flow for a Supersection. For more information about the fields shown
in this figure, see The address and Properties fields shown in the translation flows.
Table index
Supersection index
31 32-N 31-N 24 23 20 19 0
‡ Input address
31 14-N 13-N 7 6 0
UNK/
Translation base Properties Translation Table Base Register
SBZP
39 32 31 14-N 13-N 2 1 0
0 0 0 0 0 0 0 0 Translation base Table index 0 0 First-level descriptor address
First-level lookup
31 24 23 2 1 0
First-level
Supersection BA Extended Supersection BA and Properties fields 1 x
Supersection descriptor
Bits[8:5,23:20]
39 32 31 24 23 0
Extended BA Supersection BA Supersection index Output address, A[39:0]
B3-1330 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
Note
Figure B3-8 on page B3-1330 shows how, when the input address, the VA, addresses a Supersection, the top four
bits of the Supersection index bits of the address overlap the bottom four bits of the Table index bits. For more
information, see Additional requirements for Short-descriptor format translation tables on page B3-1325.
Figure B3-9 shows the complete translation flow for a Section. For more information about the fields shown in this
figure, see The address and Properties fields shown in the translation flows on page B3-1330.
31 32-N 31-N 20 19 0
‡ Table index Section index Input address
31 14-N 13-N 7 6 0
UNK/
Translation base Properties Translation Table Base Register
SBZP
39 32 31 14-N 13-N 2 1 0
0 0 0 0 0 0 0 0 Translation base Table index 0 0 First-level descriptor address
First-level lookup
31 20 19 2 1 0
Section base address Properties 1 x First-level Section descriptor
39 32 31 20 19 0
0 0 0 0 0 0 0 0 Section base address Section index Output address, A[39:0]
Figure B3-10 on page B3-1332 shows the complete translation flow for a Large page. For more information about
the fields shown in this figure, see The address and Properties fields shown in the translation flows on
page B3-1330.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1331
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
L2 table index
Page index
31 32-N 31-N 20 19 16 15 12 11 0
‡ L1 table index Input address
31 14-N 13-N 7 6 0
UNK/ Translation Table
Translation base Properties
SBZP Base Register
39 32 31 14-N 13-N 2 1 0
First-level descriptor
0 0 0 0 0 0 0 0 Translation base L1 table index 0 0
address
First-level lookup
31 10 9 2 1 0
Page table base address Properties 0 1 First-level descriptor
39 32 31 10 9 2 1 0
Second-level descriptor
0 0 0 0 0 0 0 0 Page table base address L2 table index 0 0
address
Second-level lookup
31 16 15 2 1 0
Large page base address Properties 0 1 Second-level descriptor
39 32 31 16 15 0
0 0 0 0 0 0 0 0 Large page base address Page index Output address, A[39:0]
‡ This field is absent if N is 0
L1 = First-level, L2 = Second-level
For a translation based on TTBR0, N is the value of TTBCR.N
For a translation based on TTBR1, N is 0
For details of Properties fields, see the register or descriptor description
Note
Figure B3-10 shows how, when the input address, the VA, addresses a Large page, the top four bits of the page index
bits of the address overlap the bottom four bits of the First-level table index bits. For more information, see
Additional requirements for Short-descriptor format translation tables on page B3-1325.
Figure B3-11 shows the complete translation flow for a Small page. For more information about the fields shown
in this figure, see The address and Properties fields shown in the translation flows on page B3-1330.
B3-1332 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.5 Short-descriptor translation table format
31 32-N 31-N 20 19 12 11 0
‡ L1 table index L2 table index Page index Input address
31 14-N 13-N 7 6 0
UNK/ Translation Table
Translation base Properties
SBZP Base Register
39 32 31 14-N 13-N 2 1 0
First-level descriptor
0 0 0 0 0 0 0 0 Translation base L1 table index 0 0
address
First-level lookup
31 10 9 2 1 0
Page table base address Properties 0 1 First-level descriptor
39 32 31 10 9 2 1 0
Second-level descriptor
0 0 0 0 0 0 0 0 Page table base address L2 table index 0 0
address
Second-level lookup
31 12 11 2 1 0
Small page base address Properties 1 x Second-level descriptor
39 32 31 12 11 0
0 0 0 0 0 0 0 0 Small page base address Page index Output address, A[39:0]
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1333
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
Note
• While the current implementation is limited to three levels of address lookup, its design and naming
conventions support extension to additional levels, to support a larger input address range.
• Similarly, while the current implementation limits the output address range to 40 bits, its design supports
extension to a larger output address range.
In a VMSAv7 implementation that does not include the Virtualization Extensions, the Long-descriptor translation
table format can be used for either or both the Secure and Non-secure address translations.
In an implementation that includes the Virtualization Extensions, Figure B3-2 on page B3-1310 shows the different
address translation stages, and the Long-descriptor translation table format:
• Is used for:
— The Non-secure PL2 stage 1 translation.
— The Non-secure PL1&0 stage 2 translation.
• Can be used for the Secure and Non-secure PL1&0 stage 1 translations.
When used for a stage 1 translation, the translation tables support an input address of up to 32 bits, corresponding
to the VA address range of the processor. Figure B3-12 gives a general view of stage 1 address translation when
using the Long-descriptor translation table format.
Figure B3-12 General view of stage 1 address translation using Long-descriptor format
When used for a stage 2 translation, the translation tables support an input address range of up to 40 bits, to support
the translation from IPA to PA. If the input address for the stage 2 translation is a 32-bit address, then this address
is zero-extended to 40 bits.
Note
When the Short-descriptor translation table format is used for the Non-secure stage 1 translations, this generates
32-bit IPAs. These are zero-extended to 40 bits to provide the input address for the stage 2 translation.
Figure B3-13 on page B3-1335 gives a general view of stage 2 address translation. Stage 2 translation always uses
the Long-descriptor translation table format.
B3-1334 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
First-level tables
VTTBR
1GB
Block memory Second-level tables
Indexed by region 2MB
IPA[38:30] Table Block memory Third-level table
Indexed by region
IPA[29:21] Table 4KB
Indexed by Page memory
Block IPA[20:12] page
Table Block
Table
Up to two concatenated
First-level tables, so that
IPA[39] indexes the table.
If a First-level table would contain 16 entries or fewer, first-level lookup can be omited. If so, VTTBR
points to the start of a block of concatenated Second-level tables. See text for more information.
Figure B3-13 General view of stage 2 address translation, Long-descriptor translation table format
Use of concatenated translation tables for stage 2 translations on page B3-1344 describes how using concatenated
Second-level tables means lookup can start at the Second level, as referred to in Figure B3-13.
Long-descriptor translation table format descriptors, Memory attributes in the Long-descriptor translation table
format descriptors on page B3-1337, and Control of Secure or Non-secure memory access, Long-descriptor format
on page B3-1340 describe the format of the descriptors in the Long-descriptor format translation tables.
The following sections then describe the use of this translation table format:
• Selecting between TTBR0 and TTBR1, Long-descriptor translation table format on page B3-1341.
• Long-descriptor translation table format address lookup levels on page B3-1343.
• Translation table walks, when using the Long-descriptor translation table format on page B3-1345.
Bit[1] of the descriptor indicates the descriptor type, and bit[0] indicates whether the descriptor is valid.
The following sections describe the Long-descriptor translation table descriptor formats:
• Long-descriptor translation table first-level and second-level descriptor formats.
• Long-descriptor translation table third-level descriptor formats on page B3-1337.
Information returned by a translation table lookup on page B3-1318 describes the classification of the non-address
fields in the descriptors between address map control, access controls, and region attributes.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1335
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
• In a second-level table describes the mapping of the associated 2MB input address range.
Figure B3-14 shows the Long-descriptor first-level and second-level descriptor formats:
63 1 0
Invalid IGNORED 0
63 52 51 40 39 n n-1 12 11 2 1 0
Block Upper block attributes UNK/SBZP Output address[39:n] UNK/SBZP Lower block attributes 0 1
For the first-level descriptor, n is 30. For the second-level descriptor, n is 21.
NSTable
APTable Stage 1 only,
XNTable SBZ at stage 2
PXNTable
63 62 61 60 59 58 52 51 40 39 12 11 2 1 0
Table IGNORED UNK/SBZP Next-level table address[39:12] IGNORED 1 1
In the Long-descriptor translation tables, the formats of the first-level and second-level descriptors differ only in the
size of the block of memory addressed by the block descriptor.
Descriptor bit[0] identifies whether the descriptor is valid, and is 1 for a valid descriptor. If a lookup returns an
invalid descriptor, the associated input address is unmapped, and any attempt to access it generates a Translation
fault.
0, Block The descriptor gives the base address of a block of memory, and the attributes for that memory
region.
1, Table The descriptor gives the address of the next level of translation table, and for a stage 1 translation,
some attributes for that translation.
Block descriptor
Gives the base address and attributes of a block of memory:
• For a first-level Block descriptor, bits[39:30] are bits[39:30] of the output address that
specifies a 1GB block of memory.
• For a second-level Block descriptor, bits[39:21] are bits[39:21] of the output address that
specifies a 2MB block of memory.
Bits[63:52, 11:2] provide attributes for the target memory block, see Memory attributes in the
Long-descriptor translation table format descriptors on page B3-1337. The position and contents
of these bits are identical in the second-level block descriptor and in the third-level page descriptor.
Table descriptor
Bits[39:12] are bits[39:12] of the address of the required next-level table. Bits[11:0] of the table
address are zero:
• For a first-level Table descriptor, this is the address of a second-level table.
• For a second-level Table descriptor, this is the address of a third-level table.
B3-1336 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
For a stage 1 translation only, bits[63:59] provide attributes for the next-level lookup, see Memory
attributes in the Long-descriptor translation table format descriptors.
If the implementation includes the Virtualization Extensions and the translation table defines the Non-secure PL1&0
stage 1 translations, then the output address in the descriptor is the IPA of the target block or table. Otherwise, it is
the PA of the target block or table.
63 1 0
Invalid IGNORED 0
63 2 1 0
Reserved Reserved, UNK/SBZP 0 1
63 52 51 40 39 12 11 2 1 0
Page Upper page attributes UNK/SBZP Output address[39:12] Lower page attributes 1 1
Descriptor bit[0] identifies whether the descriptor is valid, and is 1 for a valid descriptor. If a lookup returns an
invalid descriptor, the associated input address is unmapped, and any attempt to access it generates a Translation
fault.
0, Reserved, invalid
Behaves identically to encodings with bit[0] set to 0.
This encoding must not be used in third-level translation tables.
At this level, the only valid format is the Page descriptor. The other fields in the Page descriptor are:
Page descriptor
Bits[39:12] are bits[39:12] of the output address for a page of memory.
Bits[63:52, 11:2] provide attributes for the target memory page, see Memory attributes in the
Long-descriptor translation table format descriptors. The position and contents of these bits are
identical in the first-level block descriptor and in the second-level block descriptor.
If the implementation includes the Virtualization Extensions and the translation table defines the Non-secure PL1&0
stage 1 translations, then the output address in the descriptor is the IPA of the target page. Otherwise, it is the PA of
the target page.
• Table entries for stage 1 translations define attributes for the next level of lookup, see Next-level attributes in
stage 1 Long-descriptor Table descriptors on page B3-1338.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1337
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
• Block and page entries define memory attributes for the target block or page of memory. Stage 1 and stage 2
translations have some differences in these attributes, see:
— Attribute fields in stage 1 Long-descriptor Block and Page descriptors.
— Attribute fields in stage 2 Long-descriptor Block and Page descriptors on page B3-1339.
NSTable, bit[63] For memory accesses from Secure state, specifies the security level for subsequent levels of
lookup, see Hierarchical control of Secure or Non-secure memory accesses,
Long-descriptor format on page B3-1340.
For memory accesses from Non-secure state, this bit is ignored.
APTable, bits[62:61] Access permissions limit for subsequent levels of lookup, see Hierarchical control of access
permissions, Long-descriptor format on page B3-1353.
APTable[0] is reserved, SBZ, in the Non-secure PL2 stage 1 translation tables.
XNTable, bit[60] XN limit for subsequent levels of lookup, see Hierarchical control of instruction fetching,
Long-descriptor format on page B3-1356.
PXNTable, bit[59] PXN limit for subsequent levels of lookup, see Hierarchical control of instruction fetching,
Long-descriptor format on page B3-1356.
This bit is reserved, SBZ, in the Non-secure PL2 stage 1 translation tables.
Figure B3-16 Memory attribute fields in Long-descriptor stage 1 Block and Page descriptors
XN, bit[54] The Execute-never bit. Determines whether the region is executable, see Execute-never restrictions
on instruction fetching on page B3-1355.
PXN, bit[53] The Privileged execute-never bit. Determines whether the region is executable at PL1, see
Execute-never restrictions on instruction fetching on page B3-1355.
This bit is reserved, SBZ, in the Non-secure PL2 stage 1 translation tables.
nG, bit[11] The not global bit. Determines how the translation is marked in the TLB, see Global and
process-specific translation table entries on page B3-1374.
B3-1338 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
This bit is reserved, SBZ, in the Non-secure PL2 stage 1 translation tables.
AF, bit[10] The Access flag, see The Access flag on page B3-1358.
SH, bits[9:8] Shareability field, see Memory region attributes on page B3-1362.
AP[2:1], bits[7:6]
Access Permissions bits, see Memory access control on page B3-1352.
Note
For consistency with the Short-descriptor translation table formats, the Long-descriptor format
defines AP[2:1] as the Access Permissions bits, and does not define an AP[0] bit.
NS, bit[5] Non-secure bit. For memory accesses from Secure state, specifies whether the output address is in
Secure or Non-secure memory, see Control of Secure or Non-secure memory access,
Long-descriptor format on page B3-1340.
For memory accesses from Non-secure state, this bit is ignored.
AttrIndx[2:0], bits[4:2]
Stage 1 memory attributes index field, for the indicated Memory Attribute Indirection Register, see
Long-descriptor format memory region attributes on page B3-1368.
In the upper attributes block, the architecture guarantees that hardware does not alter the fields marked as IGNORED.
For more information, see Other fields in the Long-descriptor translation table format descriptors on
page B3-1369.
Figure B3-17 Memory attribute fields in Long-descriptor stage 2 Block and Page descriptors
XN, bit[54] The Execute-never bit. Determines whether the region is executable, see Execute-never restrictions
on instruction fetching on page B3-1355.
AF, bit[10] The Access flag, see The Access flag on page B3-1358.
SH, bits[9:8] Shareability field, see PL2 control of Non-secure memory region attributes on page B3-1370.
HAP[2:1], bits[7:6]
Stage 2 Access Permissions bits, see PL2 control of Non-secure access permissions on
page B3-1360.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1339
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
Note
For consistency with the AP[2:1] field, the Long-descriptor format defines HAP[2:1] as the Stage 2
Access Permissions bits, and does not define an HAP[0] bit.
MemAttr[3:0], bits[5:2]
Stage 2 memory attributes, see PL2 control of Non-secure memory region attributes on
page B3-1370.
In the upper attributes block, the architecture guarantees that hardware does not alter the fields marked as IGNORED.
For more information, see Other fields in the Long-descriptor translation table format descriptors on
page B3-1369.
• The NS bit relates only to the memory block or page at the output address defined by the descriptor.
• The descriptors also include an NSTable bit, see Hierarchical control of Secure or Non-secure memory
accesses, Long-descriptor format.
The NS and NSTable bits are valid only for memory accesses from Secure state. Memory accesses from Non-secure
state ignore the values of these bits.
NSTable == 0 The defined table address is in the Secure physical address space. In the descriptors in that
translation table, NS bits and NSTable bits have their defined meanings.
NSTable == 1 The defined table address is in the Non-secure physical address space. Because this table is fetched
from the Non-secure address space, the NS and NSTable bits in the descriptors in this table must be
ignored. This means that, for this table:
• The value of the NS bit in any block or page descriptor is ignored. The block or page address
is refers to Non-secure memory.
• The value of the NSTable bit in any table descriptor is ignored, and the table address refers
to Non-secure memory. When this table is accessed, the NS bit in any block or page
descriptor is ignored, and all descriptors in the table refer to Non-secure memory.
That is, these entries must be treated as if nG==1, regardless of the value of the nG bit. For more information about
the nG bit, see Global and process-specific translation table entries on page B3-1374.
Note
• When using the Long-descriptor format, table descriptors are defined only for the first level and second level
of lookup.
B3-1340 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
• Stage 2 translations are performed only for operations in Non-secure state, that can access only the
Non-secure address space. Therefore, the stage 2 descriptors do not include NS or NSTable bits.
B3.6.4 Selecting between TTBR0 and TTBR1, Long-descriptor translation table format
As described in Determining the translation table base address on page B3-1318, two sets of translation tables can
be defined for each of the PL1&0 stage 1 translations, and TTBR0 and TTBR1 hold the base addresses for the two
sets of tables. The Long-descriptor translation table format provides more flexibility in defining the boundary
between using TTBR0 and using TTBR1. When a PL1&0 stage 1 MMU is enabled, TTBR0 is always used. If
TTBR1 is also used then:
• TTBR1 is used for the top part of the input address range
• TTBR0 is used for the bottom part of the input address range.
The TTBCR.T0SZ and TTBCR.T1SZ size fields control the use of TTBR0 and TTBR1, as Table B3-2 shows.
a. M, N must be greater than 0.The maximum possible value for each of T0SZ and T1SZ is 7.
For stage 1 translations, the input address is always a VA, and the maximum possible VA is (232-1).
When address translation is using the Long-descriptor translation table format:
• Figure B3-18 shows how, when TTBCR.T1SZ is zero, the value of TTBCR.T0SZ controls the boundary
between VAs that are translated using TTBR0, and VAs that are translated using TTBR1.
TTBCR.T1SZ==0b000
0xFFFFFFFF
TTBR1 region
TTBR0 region Effect of increasing TTBCR.T0SZ
• Figure B3-19 on page B3-1342 shows how, when TTBCR.T1SZ is nonzero, the values of TTBCR.T0SZ and
TTBCR.T1SZ control the boundaries between VAs that are translated using TTBR0, and VAs that are
translated using TTBR1.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1341
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
0xFFFFFFFF
Effect of
TTBR1 region increasing TTBR1 region Effect of increasing TTBCR.T1SZ
TTBCR.T1SZ
Boundary,
0x80000000 Boundary, when TTBCR.T1SZ==0b001
TTBCR.T1SZ==0b001 Accesses
generate a Effect of decreasing TTBCR.T0SZ
Translation fault
0x40000000 TTBR0 region Boundary, when TTBCR.T0SZ==0b010
0x00000000
TTBCR.T0SZ==0b000 TTBCR.T0SZ>0b000
• The TTBCR contains fields that define memory region attributes for the translation table walk, for each
TTBR. These are the SH0, ORGN0, IRGN0, SH1, ORGN1, and IRGN1 bits.
• Each TTBR contains an ASID field, and the TTBCR.A1 field selects which ASID to use.
For this translation table format, Long-descriptor translation table format address lookup levels on page B3-1343
summarizes the lookup levels, and Translation table walks, when using the Long-descriptor translation table format
on page B3-1345 describes the possible translations.
Note
For a PL1&0 stage 1 translation, the input address range can be split so that the lower addresses are translated by
TTBR0 and the higher addresses are translated by TTBR1. In this case, each of input address sizes specified by
TTBCR.{T0SZ, T1SZ} is smaller than the total address size supported by the stage of translation.
The following are possible errors in the programming of TTBR0, TTBR1, and TTBCR. For the translation of a
particular address at a particular stage of translation, either:
• The block size being used to translate the address is larger than the size of the input address supported at a
stage of translation used in performing the required translation. This can occur only for the stage 1 translation
of the PL1&0 translation regime, and only when either TTBCR.T0SZ or TTBCR.T1SZ is zero, meaning
there is no gap between the address range translated by TTBR0 and the range translated by TTBR1. In this
case, this programming error occurs if a block translated from the region that has TxSZ set to zero straddles
the boundary between the two address ranges. Example B3-2 on page B3-1343 shows an example of this
mis-programming.
• The address range translated by a set of blocks marked as contiguous, by use of the contiguous bit, is larger
than the size of the input address supported at a stage of translation used in performing the required
translation.
B3-1342 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
To understand why this must be a programming error, consider a memory access to address 0xFFFF0000. According
to the TTBCR.{T0SZ, T1SZ} values, this must be translated using TTBR1. However, the access matches a TLB
entry for the translation, using TTBR0, of the block at 0xC0000000. Hardware is not required to detect that the access
to 0xFFFF0000 is being translated incorrectly.
• Treat such a block, that might be a block within a contiguous set of blocks, as causing a Translation fault,
even though the block is valid, and the address accessed within that block is within the size of the input
address supported at a stage of translation.
• Treat such a block, that might be a block within a contiguous set of blocks, as not causing a Translation fault,
even though the address accessed within that block is outside the size of the input address supported at a stage
of translation, provided that both of the following apply:
— The block is valid.
— At least one address within the block, or contiguous set of blocks, is within the size of the input address
supported at a stage of translation.
Table B3-3 summarizes the properties of the three levels of address lookup when using this format.
Table B3-3 Properties of the three levels of address lookup with Long-descriptor translation tables
For first-level and second-level tables, reducing the input address range reduces the number of addresses in the table
and therefore reduces the table size.The appropriate Translation Table Control Register specifies the input address
range.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1343
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
Stage 1 translations require an input address range of up to 32 bits, corresponding to VA[31:0]. For these
translations:
• For a memory access from a mode other than Hyp mode, the Secure or Non-secure TTBR0 or TTBR1 holds
the translation table base address, and the Secure or Non-secure TTBCR is the control register.
• For a memory access from Hyp mode, HTTBR holds the translation table base address, and HTCR is the
control register.
Note
For translations controlled by TTBR0 and TTBR1, if neither Translation table base register has an input address
range larger than 1GB, then translation starts at the second level. Together, TTBR0 and TTBR1 can still cover the
32-bit VA input address range.
Stage 2 translations require an input address range of up to 40 bits, corresponding to IPA[39:0], and the supported
input address size is configurable in the range 25-40 bits. Table B3-3 on page B3-1343 indicates a requirement for
the translation mechanism to support a 39-bit input address range, Address[38:0]. Use of concatenated translation
tables for stage 2 translations describes how a 40-bit IPA address range is supported. For stage 2 translations:
• VTTBR holds the translation table base address, and VTCR is the control register.
• If a supplied input address is larger than the configured input address size, a Translation fault is generated.
• Require the corresponding number of concatenated translation tables at the next translation level, aligned to
the size of the block of concatenated translation tables.
Note
Stage 2 translations always use the Long-descriptor translation table format.
• Required when the stage 2 translation supports a 40-bit input address range, see Use of concatenated
first-level translation tables on page B3-1345.
• Supported for a stage 2 translation with an input address range of 31-34 bits, see Use of concatenated
second-level translation tables on page B3-1345.
Note
This translation scheme:
• Avoids the overhead of an additional level of translation.
• Requires the software that is defining the translation to:
— Define the concatenated translation tables with the required overall alignment.
— Program VTTBR to hold the address of the first of the concatenated translation tables.
— Program VTCR to indicate the required input address range and first lookup level.
B3-1344 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
The Long-descriptor format translation tables provide 9 bits of address resolution at each level of lookup. However,
a 40-bit input address range with a translation granularity of 4KB requires a total of 28 bits of address resolution.
Therefore, a stage 2 translation that supports a 40-bit input address range requires two concatenated first-level
translation tables, together aligned to 8KB, where:
• The table at the address with PA[12:0]==0b0000000000000 defines the translations for input addresses with
bit[39]==0.
• The table at the address with PA[12:0]==0b1000000000000 defines the translations for input addresses with
bit[39]==1.
• The 8KB alignment requirement means that both table have the same value for PA[39:13].
A stage 2 translation with an input address range of 31-34 bits can start the translation either:
• With a first-level lookup, accessing a first-level translation table with 2-16 entries.
• With a second-level lookup, accessing a set of concatenated second-level translation tables.
Table B3-4 shows these options, for each of the input address ranges that can use this scheme.
Note
Because these are stage 2 translations, the input address range is an IPA range.
Table B3-4 Possible uses of concatenated translation tables for second-level lookup
Input address range Lookup starts at first level Lookup starts at second level
IPA range Size Required first-level entries Number of concatenated tables Required alignment a
See also Determining the required first lookup level for stage 2 translations on page B3-1348.
B3.6.6 Translation table walks, when using the Long-descriptor translation table format
Figure B3-2 on page B3-1310 shows the possible address translations in an Large Physical Address Extension
implementation. These are:
Stage 1 translations
For all stage 1 translations:
• The input address range is up to 32 bits, as determined by either:
— TTBCR.T0SZ or TTBCR.T1SZ, for a PL1&0 stage 1 translation.
— HTCR.T0SZ, for a PL2 stage 1 translation.
• The output address range is 40 bits.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1345
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
Stage 2 translation
Non-secure PL1&0 stage 2 translation
The stage 2 translation for memory accesses from Non-secure modes other than Hyp
mode. Supported only if the implementation includes the Virtualization Extensions, and
translates an IPA to a PA. For this translation:
• The input address range is 40 bits, as determined by VTCR.T0SZ.
• The output address range depends on the implemented memory system, and is up
to 40 bits.
• VTTBR holds the translation table base address.
• VTCR specifies the required input address range, and whether the first lookup is
at the first level or at the second level.
The Long-descriptor translation table format provides up to three levels of address lookup, as described in
Long-descriptor translation table format address lookup levels on page B3-1343, and the first lookup, in which the
MMU reads the translation table base address, is at either the first level or the second level. The following
determines the level of the first lookup:
• For a stage 1 translation, the required input address range. For more information see Determining the required
first lookup level for stage 1 translations on page B3-1348.
• For a stage 2 translation, the level specified by the VTCR.SL0 field. For more information see Determining
the required first lookup level for stage 2 translations on page B3-1348.
Note
For a stage 2 translation, the size of the required input address range constrains the VTCR.SL0 value.
Figure B3-20 on page B3-1347 shows how the descriptor address for the first lookup for a translation using the
Long-descriptor translation table format is determined from the input address and the Translation table base register
value. This figure shows the lookup for a translation that starts with a first-level lookup, that translates bits[39:30]
of the input address, zero extended if necessary.
B3-1346 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
n+27
n+26
39 30 29 0
‡ Input address
63 56 55 48 47 40 39 n n-1 0
Translation table
UNK/SBZP Register-defined UNK/SBZP Translation table base address[39:n] UNK/SBZP
base register
n-1
39 n 3 2 0
0 0 0 Descriptor address†
See text for more information about the translation table base register used, and the value of n.
‡ This field is absent if n is 13.
† For a Non-secure PL1&0 stage 1 translation, the IPA of the descriptor. Otherwise, the PA of the descriptor.
For a translation that starts with a first-level lookup, as shown in Figure B3-20:
For a translation that starts with a second-level lookup, the descriptor address is obtained in the same way, except
that bits[(n+17):21] of the input address provide bits[(n-1):3] of the descriptor address, where:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1347
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
• Less than or equal to 230 bytes, the required start is at the second level, and translation requires two levels of
table to map to 4KB pages. This corresponds to a TxSZ value of 2 or more.
• More than 230 bytes, the required start is at the first level, and translation requires three levels of table to map
to 4KB pages. This corresponds to a TxSZ value that is less than 2.
• Splits the 32-bit VA input address range between TTBR0 and TTBR1, see Selecting between TTBR0 and
TTBR1, Long-descriptor translation table format on page B3-1341.
• Holds the input address range sizes for TTBR0 and TTBR1, in the TTBCR.T0SZ and TTBCR.T1SZ fields.
For translations in Hyp mode, HTCR.T0SZ indicates the size of the required input address range. For example, if
this field is 0b000, it indicates a 32-bit VA input address range, and translation lookup must start at the first level.
VTCR.T0SZ must indicate the required input address range. The size of the input address region is 2(32-T0SZ) bytes.
Note
VTCR.T0SZ holds a four-bit signed integer value, meaning it supports values from -8 to 7. This is different from
the other translation control registers, where TnSZ holds a three-bit unsigned integer, supporting values from 0 to 7.
The programming of VTCR must follow the constraints shown in Table B3-5, otherwise behavior is
UNPREDICTABLE. The table also shows how the VTCR.SL0 and VTCR.T0SZ values determine the
VTTBR.BADDR field width.
VTCR.SL0 VTCR.T0SZ Input address range, R First lookup level BADDR[39:x] width a
a. The first range corresponds to the first T0SZ value, the second range to the second T0SZ value.
Where necessary, the first lookup level provides multiple concatenated translation tables, as described in Use of
concatenated second-level translation tables on page B3-1345. This section also gives more information about the
alternatives, shown in Table B3-5, when R is in the range 231 -234.
B3-1348 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
The following sections describe full Long-descriptor format translation flows, down to an entry for a 4KB page:
• The address and Properties fields shown in the translation flows.
• Full translation flow, starting at first-level lookup.
• Full translation flow, starting at second-level lookup on page B3-1351.
On an implementation that includes the Virtualization Extensions, for the Non-secure PL1&0 stage 1 translation:
• Any descriptor address is the IPA of the required descriptor.
• The final output address is the IPA of the block or page.
In these cases, a PL1&0 stage 2 translation is performed to translate the IPA to the required PA.
For all other translations, the final output address is the PA of the block or page, and any descriptor address is the
PA of the descriptor.
Properties indicates register or translation table fields that return information, other than address information, about
the translation or the targeted memory region. For more information see Information returned by a translation table
lookup on page B3-1318, and the description of the register or translation table descriptor.
For translations using the Long-descriptor translation table format, Long-descriptor translation table format
descriptors on page B3-1335 describes the descriptors formats.
Figure B3-21 on page B3-1350 shows the complete translation flow for a stage 1 translation table walk that starts
at a first-level lookup. For more information about the fields shown in the figure see The address and Properties
fields shown in the translation flows.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1349
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
63 56 55 48 47 40 39 n n-1 0
Translation table
UNK/SBZP Properties UNK/SBZP Translation table base address[39:n] UNK/SBZP
base register
n-1
39 n 3 2 0
Descriptor
0 0 0
address
First-level lookup
63 59 58 52 51 40 39 12 11 2 1 0
First-level
Properties IGNORED SBZ Second-level table address[39:12] IGNORED 1 1 table descriptor
39 12 11 3 2 0
Descriptor
0 0 0
address
Second-level lookup
63 59 58 52 51 40 39 12 11 2 1 0
Second-level
Properties IGNORED SBZ Third-level table address[39:12] IGNORED 1 1
table descriptor
39 12 11 3 2 0
Descriptor
0 0 0
address
Third-level lookup
63 52 51 40 39 12 11 2 1 0
Third-level
Properties SBZ Output address[39:12] Properties 1 1
page descriptor
Figure B3-21 Complete Long-descriptor format stage 1 translation, starting at first level
If the first-level lookup or second-level lookup returns a block descriptor then the translation table walk completes
at that level.
A stage 2 translation that starts at a first-level lookup differs from the translation shown in Figure B3-21 only as
follows:
• The possible values of n are 4-13, to support an input address of between 31 and 40 bits.
• A descriptor and output addresses are always the PAs.
B3-1350 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.6 Long-descriptor translation table format
Figure B3-22 shows the complete translation flow for a stage 1 translation table walk that starts at a second-level
lookup. For more information about the fields shown in the figure see The address and Properties fields shown in
the translation flows on page B3-1349.
63 56 55 48 47 40 39 n n-1 0
Translation table
UNK/SBZP Properties UNK/SBZP Translation table base address[39:n] UNK/SBZP
base register
39 n n-1 3 2 0
Descriptor
0 0 0
address
Second-level lookup
63 59 58 52 51 40 39 12 11 2 1 0
Second-level
Properties IGNORED SBZ Third-level table address[39:12] IGNORED 1 1
table descriptor
39 12 11 3 2 0
Descriptor
0 0 0
address
Third-level lookup
63 52 51 40 39 12 11 2 1 0
Third-level
Properties SBZ Output address[39:12] Properties 1 1
page descriptor
Figure B3-22 Complete Long-descriptor format stage 1 translation, starting at second level
If the second-level lookup returns a block descriptor then the translation table walk completes at that level.
A stage 2 translation that starts at a second-level lookup differs from the translation shown in Figure B3-22 only as
follows:
• The possible values of n are 7-16, to support an input address of up to 34 bits.
• The descriptor and output addresses are always PAs.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1351
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
Note
This section gives a general description of memory access permissions. In an implementation that includes the
Virtualization Extensions, software executing at PL1 in Non-secure state can see only the access permissions
defined by the Non-secure PL1&0 stage 1 translations. However, software executing at PL2 can modify these
permissions, as described in PL2 control of Non-secure access permissions on page B3-1360. This modification is
invisible to Non-secure software executing at PL1 or PL0.
Access permission bits in a translation table descriptor control access to the corresponding memory region. The
Short-descriptor translation table format supports two options for defining the access permissions:
• Three bits, AP[2:0], define the access permissions.
• Two bits, AP[2:1], define the access permissions, and AP[0] can be used as an Access flag.
SCTLR.AFE selects the access permissions option. Setting this bit to 1, to enable the Access flag, also selects use
of AP[2:1] to define access permissions.
The Long-descriptor translation table format uses only AP[2:1] to control the access permissions, and provides an
AF bit for use as an Access flag. This means the VMSA behaves as if SCTLR.AFE is set to 1, regardless of the value
that software has written to this bit.
Note
When use of the Long-descriptor format is enabled, SCTLR.AFE is UNK/SBOP.
From the introduction of the Large Physical Address Extension, ARM deprecates any use of the AP[2:0] scheme
for defining access permissions, see Deprecations relating to using the AP[2:0] scheme for defining MMU access
permissions on page D9-2464.
The Access flag on page B3-1358 describes the Access flag, for both translation table formats.
The XN and PXN bits provide additional access controls for instruction fetches, see Execute-never restrictions on
instruction fetching on page B3-1355.
An attempt to perform a memory access that the translation table access permission bits do not permit generates a
Permission fault, for the corresponding stage of translation. However, when using the Short-descriptor translation
table format, it generates the fault only if the access is to memory in the Client domain, see Domains,
Short-descriptor format only on page B3-1358.
B3-1352 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
Note
In an implementation that includes the Virtualization Extensions, memory accesses made in Non-secure state at PL1
or PL0 are subject to two stages of translation. Each stage of translation has its own, independent, fault checking.
Fault handling is different for the two stages, see Exception reporting in a VMSA implementation on page B3-1406.
• AP[2:0] access permissions control, Short-descriptor format only on page B3-1354. This section includes
some information on access permission control in earlier versions of the ARM VMSA.
Note
Some documentation describes this as the simplified access permissions model.
In this model:
• One bit, AP[2], selects between read-only and read/write access.
• A second bit, AP[1], selects between Application level (PL0) and System level (PL1) control.
For the Non-secure PL2 stage 1 translations, AP[1] is SBO.
a. Not valid for Non-secure PL2 stage 1 translation tables. AP[1] is SBO in these tables.
The Long-descriptor translation table format introduces a mechanism that entries at one level of translation table
lookup can use to set limits on the permitted entries at subsequent levels of lookup. This applies to the access
permissions, and also to the restrictions on instruction fetching described in Hierarchical control of instruction
fetching, Long-descriptor format on page B3-1356.
The restrictions apply only to subsequent levels of lookup at the same stage of translation. The APTable[1:0] field
restricts the access permissions, as Table B3-7 on page B3-1354 shows.
As stated in the table footnote, for the Non-secure PL2 stage 1 translation tables, APTable[0] is reserved, SBZ.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1353
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
APTable[1:0] Effect
10 Write access not permitted, at any privilege level, regardless of permissions in subsequent levels of lookup.
Note
The APTable[1:0] settings are combined with the translation table access permissions in the translation tables
descriptors accessed in subsequent levels of lookup. They do not restrict or change the values entered in those
descriptors.
The Long-descriptor format provides APTable[1:0] control only for the stage 1 translations. The corresponding bits
are SBZ in the stage 2 translation table descriptors.
When APTable[1:0] is not set to 0b00, its effects might be held in one or more TLB entries. Therefore, a change to
APTable[1:0] might require coarse-grained invalidation of the TLB to ensure that the effect of the change is visible
to subsequent memory transactions.
When SCTLR.AFE is set to 0, ensuring that the AP[0] bit is always set to 1 effectively changes the access model to
the simpler model described in AP[2:1] access permissions model on page B3-1353.
1 00 - - Reserved
a. From VMSAv7, ARM strongly recommends use of the 0b11 encoding for Read-only at any privilege level.
b. This mapping is introduced in VMSAv7, and is reserved in VMSAv6.
B3-1354 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
Note
• Before VMSAv7, the SCTLR.S and SCTLR.R bits also affect the access permissions. For more information,
see Translation attributes on page D15-2591.
• VMSAv7 supports the full set of access permissions shown in Table B3-8 on page B3-1354 only when
SCTLR.AFE is set to 0. When SCTLR.AFE is set to 1, the only supported access permissions are those
described in AP[2:1] access permissions model on page B3-1353.
• Some documentation describes the AP[2] bit in the translation table entries as the APX bit.
XN, Execute-never
When the XN bit is 1, a Permission fault is generated if the processor attempts to execute an
instruction fetched from the corresponding memory region. However, when using the
Short-descriptor translation table format, the fault is generated only if the access is to memory in the
Client domain, see Domains, Short-descriptor format only on page B3-1358. A processor can
execute instructions from a memory region only if the access permissions for its current state permit
read access, and the XN bit is set to 0.
In both the Short-descriptor format and the Long-descriptor format translation tables, all descriptors for memory
blocks and pages always include an XN bit.
• The Long-descriptor translation table formats always include the PXN bit.
• On an implementation that does not include the Large Physical Address Extension, support for use of the
PXN bit is OPTIONAL, and:
— If use of the PXN bit is supported, the Short-descriptor translation table formats include the PXN bit.
— Otherwise, the Short-descriptor translation table formats do not include the PXN bit.
Short-descriptor translation table first-level descriptor formats on page B3-1322 describes how support for
the PXN bit affects the Short-descriptor translation table formats.
Note
An implementation that does not include the Large Physical Address Extension always uses the Short-descriptor
translation table formats.
In the Non-secure PL2 stage 1 translation tables, the PXN bit is reserved, SBZ.
In addition, the Virtualization Extensions provide controls that enforce execute-never restrictions, regardless of the
settings in the translation tables. Execute-never controls provided by the Virtualization Extensions on page B3-1357
describes these controls.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1355
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
The execute-never controls apply also to speculative instruction fetching. This means a speculative instruction fetch
from a memory region that is execute-never at the current level of privilege is prohibited.
The XN control means that, when the MMU is enabled, the processor can fetch, or speculatively fetch, an instruction
from a memory location only if all of the following apply:
• If using the Short-descriptor translation table format, the translation table descriptor for the location does not
indicate that it is in a No access domain.
• If using the Long-descriptor translation table format, or using the Short descriptor format and the descriptor
indicates that the location is in a Client domain, in the descriptor for the location the following apply:
— XN is set to 0.
— The access permissions permit a read access from the current processor mode.
Note
• The PXN control applies to the processor privilege when it attempts to execute the instruction. In an
implementation that fetches instructions speculatively, this might not be the privilege when the instruction
was prefetched. Therefore, the architecture does not require the PXN control to prevent instruction fetching.
• Although the execute-never controls apply to speculative fetching, on a speculative instruction fetch from an
execute-never location, no Permission fault is generated unless the processor attempts to execute the
instruction fetched from that location. This means that, if a speculative fetch from an execute-never location
is attempted, but there is no attempt to execute the corresponding instruction, a Permission fault is not
generated.
• The software that defines a translation table must mark any region of memory that is read-sensitive as
execute-never, to avoid the possibility of a speculative fetch accessing the memory region. For example, it
must mark any memory region that corresponds to a read-sensitive peripheral as Execute-never.
• When using the Short-descriptor translation table format, the XN attribute is not checked for domains marked
as Manager. Therefore, the system must not include read-sensitive memory in domains marked as Manager,
because the XN bit does not prevent speculative fetches from a Manager domain.
When no MMU for the translation regime is enabled, memory regions cannot have XN or PXN attributes assigned.
Behavior of instruction fetches when all associated MMUs are disabled on page B3-1314 describes how disabling
all MMUs affects instruction fetching.
The restrictions apply only to subsequent levels of lookup at the same stage of translation, and:
B3-1356 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
Note
The XNTable and PXNTable settings are combined with the XN and PXN bits in the translation table descriptors
accessed at subsequent levels of lookup. They do not restrict or change the values entered in those descriptors.
The XNTable and PXNTable controls are provided only in the Long-descriptor translation table format, and only
for stage 1 translations. The corresponding bits are SBZ in the stage 2 translation table descriptors.
When XNTable, or PXNTable, is set to 1, its effects might be held in one or more TLB entries. Therefore, a change
to XNTable or PXNTable might require coarse-grained invalidation of the TLB to ensure that the effect of the
change is visible to subsequent memory transactions.
The Virtualization Extensions add a Secure instruction fetch bit, SCR.SIF. When this bit is set to 1, any attempt in
Secure state to execute an instruction fetched from Non-secure physical memory causes a Permission fault. As with
all Permission fault checking, when using the Short-descriptor format translation tables the check applies only to
Client domains, see Access permissions on page B3-1352.
ARM expects SCR.SIF to be static during normal operation. In particular, whether the TLB holds the effect of the
SIF bit is IMPLEMENTATION DEFINED. The generic sequence to ensure visibility of a change to the SIF bit is:
The Virtualization Extensions add control bits that, when the corresponding stage 1 MMU is enabled, force writable
memory to be treated as XN, regardless of the setting of the XN bit:
• For Secure and Non-secure PL1&0 stage 1 translations, when SCTLR.WXN is set to 1, all regions that are
writable at stage 1 of the address translation are treated as XN.
• For Non-secure PL2 stage 1 translations, when HSCTLR.WXN is set to 1, all regions that are writable at
stage 1 of the address translation are treated as XN.
• For Secure and Non-secure PL1&0 stage 1 translations, when SCTLR.UWXN is set to 1, an instruction fetch
is treated as accessing a PXN region if it accesses a region that software executing at PL0 can write to.
For more information about the control bits see SCTLR, System Control Register, VMSA on page B4-1700 and
HSCTLR, Hyp System Control Register, Virtualization Extensions on page B4-1587.
Note
Setting a WXN or UWXN bit to 1 changes the interpretation of the translation table entry, overriding a zero value
of an XN or PXN field. It does not cause any change to the translation table entry.
For any given virtual machine, ARM expects WXN and UWXN to remain static in normal operation. In particular,
it is IMPLEMENTATION DEFINED whether TLB entries associated with a particular VMID reflect the effect of the
values of these bits. A generic sequence to ensure synchronization of a change to these bits, when that change is
made without a corresponding change of VMID, is:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1357
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
As with all Permission fault checking, if the stage 1 translation is using the Short-descriptor translation table format,
the permission checks are performed only for Client domains. For more information see Access permissions on
page B3-1352.
For more information about address translation see About address translation on page B3-1309.
• First-level translation table entries for Page tables and Sections include a domain field.
• Translation table entries for Supersections do not include a domain field. The Short-descriptor format defines
Supersections as being in domain 0.
• Second-level translation table entries inherit a domain setting from the parent first-level Page table entry.
The domain field specifies which of the 16 domains the entry is in, and a two-bit field in the DACR defines the
permitted access for each domain. The possible settings for each domain are:
No access Any access using the translation table descriptor generates a Domain fault.
Clients On an access using the translation table descriptor, the access permission attributes are checked.
Therefore, the access might generate a Permission fault.
Managers On an access using the translation table descriptor, the access permission attributes are not checked.
Therefore, the access cannot generate a Permission fault.
See The MMU fault-checking sequence on page B3-1395 for more information about how, when using the
Short-descriptor translation table format, the Domain attribute affects the checking of the other attributes in the
translation table descriptor.
Note
A single program might:
• Be a Client of some domains.
• Be a Manager of some other domains.
• Have no access to the remaining domains.
The Long-descriptor translation table format does not support domains. When a stage of translation is using this
format, all memory is treated as being in a Client domain, and the settings in the DACR are ignored.
• If address translation is using the Short-descriptor translation table format, it must set SCTLR.AFE to 1 to
enable use of the Access flag, see SCTLR, System Control Register, VMSA on page B4-1700. Setting this bit
to 1 redefines the AP[0] bit in the translation table descriptors as an Access flag, and limits the access
permissions information in the translation table descriptors to AP[2:1], as described in AP[2:1] access
permissions model on page B3-1353.
B3-1358 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
Note
ARMv6K introduces the Access flag mechanism. In earlier versions of the architecture, the SCTLR.AFE bit
is RAZ/WI. For more information see CP15 c1, System Control Register, SCTLR on page D12-2515.
• The Long-descriptor format always supports an Access flag bit in the translation table descriptors, and
address translation using this format behaves as if SCTLR.AFE is set to 1, regardless of the value of that bit.
The Access flag can be managed by software or by hardware. However, support for hardware management of the
Access flag is OPTIONAL and deprecated. The following subsections describe the management options:
• Software management of the Access flag.
• Hardware management of the Access flag.
Note
When using the Short-descriptor translation table format, Access flag faults are generated only if SCTLR.AFE is
set to 1, to enable use of a translation table descriptor bit as an Access flag.
The Access flag mechanism expects that, when an Access flag fault occurs, software resets the Access flag to 1 in
the translation table entry that caused the fault. This prevents the fault occurring the next time that memory location
is accessed. Entries with the Access flag set to 0 are never held in the TLB, meaning software does not have to flush
the entry from the TLB after setting the flag.
An implementation that provides hardware management of the Access flag for the Secure and Non-secure PL1&0
stage 1 translations:
• Uses the HW Access flag field, ID_MMFR2[31:28], to indicate this implementation choice.
• Implements the SCTLR.HA bit. This bit must be set to 1 to enable hardware management of the Access flag.
Note
When using the Short-descriptor translation table format, hardware management of the Access flag is performed
only if both:
• SCTLR.AFE is set to 1, to enable use of an Access flag.
• SCTLR.HA is set to 1, to enable hardware management of the Access flag.
The Banking of SCTLR means that these bits are defined independently for the Secure and Non-secure address
translations.
When hardware management of the Access flag, is enabled for a stage of address translation, no Access flag faults
are generated for the corresponding translations.
Any implementation of hardware management of the Access flag must ensure that any software changes to the
translation table are not overwritten. The architecture does not require software that changes translation table entries
to use interlocked operations. The hardware management mechanisms for the Access flag must prevent any loss of
data written to translation table entries that might occur when, for example, a write by another processor occurs
between the read and write phases of a translation table walk that updates the Access flag.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1359
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
Architecturally, an operating system that uses the Access flag must support the software faulting option that
generates Access flag faults. This provides compatibility between systems that include a hardware implementation
of the Access flag and those systems that do not implement this feature.
ARM deprecates any use of the SCTLR.HA bit. That is, in an implementation where this bit is RW, it deprecates
setting this bit to 1 to enable hardware management of the Access flag.
• The translation tables that control the Non-secure PL2 stage 1 translations. These map VAs to PAs, for
memory accesses made when executing in Non-secure state at PL2, and are indicated and controlled by the
HTTBR and HTCR.
These translations have similar access controls to other Non-secure stage 1 translations using the
Long-descriptor translation table format, as described in:
— AP[2:1] access permissions model on page B3-1353.
— Execute-never restrictions on instruction fetching on page B3-1355.
The differences from the Non-secure stage 1 translations are that:
— The APTable[0], PXNTable, and PXN bits are reserved, SBZ.
— AP[1] is reserved, SBO.
• The translation tables that control the Non-secure PL1&0 stage 2 translations. These map the IPAs from the
stage 1 translation onto PAs, for memory accesses made when executing in Non-secure state at PL1 or PL0,
and are indicated and controlled by the VTTBR and VTCR.
The descriptors in the virtualization translation tables define a second level of access permissions, that are
overlaid onto the permissions defined in the stage 1 translation. This section describes this overlaying of
access permissions.
Note
In an implementation of virtualization, the second-level access permissions mean a hypervisor can define additional
access restrictions to those defined by a Guest OS in the stage 1 translation tables. For a particular access, the actual
access permission is the more restrictive of the permissions defined by:
• The Guest OS, in the stage 1 translation tables.
• The hypervisor, in the stage 2 translation tables.
The HAP[2:1] field in the stage 2 descriptors define the stage 2 access permissions, as Table B3-9 on page B3-1361
shows:
B3-1360 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.7 Memory access control
00 No access permitted
01 Read-only. Writes to the region are not permitted, regardless of the stage 1 permissions.
10 Write-only. Reads from the region are not permitted, regardless of the stage 1 permissions.
11 Read/write. The stage 1 permissions determine the access permissions for the region.
For more information about the HAP[2:1] field see Attribute fields in stage 2 Long-descriptor Block and Page
descriptors on page B3-1339.
If the stage 2 permissions cause a Permission fault, this is a stage 2 MMU fault. Stage 2 MMU faults are taken to
Hyp mode, and reported in the HSR using an EC code of 0x20 or 0x24. For more information, see Use of the HSR
on page B3-1421.
Note
The combination of the EC code and the STATUS value in the HSR indicate that the fault is a stage 2 MMU fault.
The stage 2 permissions include an XN attribute. If this is set to 1, execution from the region is not permitted,
regardless of the value of the XN attribute in the stage 1 translation. If a Permission fault is generated because the
stage 2 XN bit is set to 1, this is reported as a stage 2 MMU fault.
Prioritization of aborts on page B3-1404 describes the abort prioritization if both stages of a translation generate a
fault.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1361
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
The following sections describe the assignment of memory region attributes for stage 1 translations:
• Overview of memory region attributes for stage 1 translations.
• Short-descriptor format memory region attributes, without TEX remap on page B3-1363.
• Short-descriptor format memory region attributes, with TEX remap on page B3-1364.
• Long-descriptor format memory region attributes on page B3-1368.
For an implementation that does not include the Virtualization Extensions, and for an implementation that includes
the Virtualization Extensions and is operating in Secure state, or in Hyp mode, these assignments define the memory
attributes of the accessed region.
For an implementation that includes the Virtualization Extensions and is operating in a Non-secure PL1 or PL0
mode, the Non-secure PL1&0 stage 2 translation can modify the memory attributes assigned by the stage 1
translation. PL2 control of Non-secure memory region attributes on page B3-1370 describes these stage 2
assignments.
The description of the TRE == 0 encoding includes information about the encoding in
previous versions of the architecture.
TRE == 1 Remap enabled. The TEX[0], C, and B bits in the translation table descriptor are index
bits to the MMU remap registers, that define the memory region attributes:
• The Primary Region Remap Register, PRRR.
• The Normal Memory Remap Register, NMRR.
Short-descriptor format memory region attributes, with TEX remap on page B3-1364
describes this encoding scheme.
This scheme reassigns translation table descriptor bits TEX[2:1] for use as bits managed
by the operating system.
The Long-descriptor translation table format always uses remapping. This means the VMSA
behaves as if SCTLR.TRE is set to 1, regardless of the value that software has written to this bit.
B3-1362 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
Note
When use of the Long-descriptor format is enabled, SCTLR.TRE is UNK/SBOP.
Long-descriptor format memory region attributes on page B3-1368 describes this encoding.
Shareability In the Short-descriptor translation table format, the S bit in the translation table descriptor encodes
whether the region is shareable. Enabling TEX remap extends the shareability description. For more
information see:
• Shareability and the S bit, without TEX remap on page B3-1364.
• Shareability and the S bit, with TEX remap on page B3-1366.
In the Long-descriptor translation table format, the SH[1:0] field in the translation table descriptor
encodes shareability information. For more information see Shareability, Long-descriptor format on
page B3-1369.
Note
• The Short-descriptor format scheme without TEX remap is the scheme used in VMSAv6.
• The B (Bufferable), C (Cacheable), and TEX (Type extension) bit names are inherited from earlier versions
of the architecture. These names no longer adequately describe the function of the B, C, and TEX bits.
Table B3-10 shows the C, B, and TEX[2:0] encodings when TEX remap is disabled:
1 Reserved - -
1 Reserved - -
1 x Reserved - -
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1363
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
011 x x Reserved - -
a. For more information, see Shareable attribute for Device memory regions on page A3-134. Some implementations make no distinction
between Shareable Device memory and Non-shareable Device memory, and refer to both memory types as Shareable Device memory.
b. For more information, see Shareability and the S bit, without TEX remap.
c. For more information, see Cacheable memory attributes, without TEX remap.
See Memory types and attributes and the memory order model on page A3-123 for an explanation of Normal,
Strongly-ordered and Device memory types, and of the shareability attribute.
The translation table entries use the same encoding for the Outer and Inner cache attributes, as Table B3-11 shows.
00 Non-cacheable
01 Write-Back, Write-Allocate
10 Write-Through, no Write-Allocate
11 Write-Back, no Write-Allocate
• The software that defines the translation tables must program the PRRR and NMRR to define seven possible
memory region attributes.
• The TEX[0], C, and B bits of the translation table descriptors define the memory region attributes, by
indexing PRRR and NMRR.
• Hardware makes no use TEX[2:1], see The OS managed translation table bits on page B3-1368.
B3-1364 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
• or seven of the eight possible combinations of the TEX[0], C and B bits, fields in the PRRR and NMRR
define the region attributes, as described in this section.
• The meaning of the eighth combination for the TEX[0], C and B bits is IMPLEMENTATION DEFINED.
• Four bits in the PRRR define whether the region is shareable, as described in Shareability and the S bit, with
TEX remap on page B3-1366.
For each of the possible encodings of the TEX[0], C, and B bits in a translation table entry, Table B3-12 shows
which fields of the PRRR and NMRR registers describe the memory region attributes.
1 0 IMPLEMENTATION DEFINED
a. For details of the Memory type and Outer Shareable encodings see PRRR, Primary Region Remap Register, VMSA on page B4-1693. For
details of the Cache attributes encodings see Table B3-11 on page B3-1364.
b. Applies only if the memory type for the region is mapped as Normal memory.
c. Applies only if the memory type for the region is mapped as Normal or Device memory and the region is Shareable.
If an implementation includes the Security Extensions, the TEX remap registers and the SCTLR.TRE bit are Banked
between the Secure and Non-secure security states. For more information, see The effect of the Security Extensions
on TEX remap on page B3-1368.
When TEX remap is enabled, the mappings specified by the PRRR and NMRR determine the mapping of the
TEX[0], C and B bits in the translation tables to memory type and cacheability attributes:
1. The primary mapping, indicated by a field in the PRRR as shown in the Memory region column of
Table B3-12, takes precedence.
2. For any region that the PRRR maps as Normal memory, the NMRR determines the Inner cacheability and
Outer cacheability attributes.
3. If it is supported, the Outer Shareable mapping identifies Shareable memory as either Inner Shareable or
Outer Shareable, see Interpretation of the NOSn fields in the PRRR, with TEX remap on page B3-1367.
The TEX remap registers must be static during normal operation. In particular, when the remap registers are
changed:
I
• t is IMPLEMENTATION DEFINED when the changes take effect.
• It is UNPREDICTABLE whether the TLB caches the effect of the TEX remap on translation tables.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1365
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
The software sequence to ensure the synchronization of changes to the TEX remap registers is:
1. Perform a DSB. This ensures any memory accesses using the old mapping have completed.
2. Write the TEX remap registers or SCTLR.TRE bit.
3. Perform an ISB. This ensures synchronization of the register updates.
4. Invalidate the entire TLB.
5. Perform a DSB. This ensures completion of the entire TLB operation.
6. Clean and invalidate all caches. This removes any cached information associated with the old mapping.
7. Perform a DSB. This ensures completion of the cache maintenance.
8. Perform an ISB. This ensures instruction synchronization.
This extends the standard rules for the synchronization of changes to CP15 registers described in Synchronization
of changes to system control registers on page B3-1457, and provides implementation freedom as to whether or not
the effect of the TEX remap is cached.
• If the memory type is Normal then the shareability is determined by using the value of the S bit in the
translation table descriptor to index bits in the PRRR.
In the cases where the shareability is remapped, the appropriate bit of the PRRR indicates whether the region is
Shareable or Non-shareable, as follows:
PRRR[n] == 1 Shareable.
Note
When TEX remap is enabled, a translation table entry with S == 0 can be mapped as Shareable memory.
B3-1366 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
• The region is mapped as Normal memory, or the implementation does not include the Large Physical Address
Extension and the region is mapped as Device memory.
• The Normal memory remapping or Device memory remapping of the S bit value for the entry makes the
region Shareable.
• The implementation supports the distinction between Inner Shareable and Outer Shareable.
If the SCTLR.TRE bit is set to 0, an implementation can provide an IMPLEMENTATION DEFINED mechanism to
interpret the NOSn fields in the PRRR, see SCTLR.TRE, SCTLR.M, and the effect of the TEX remap registers.
The values of the NOSn fields in the PRRR have no effect if any of the following apply:
• The SCTLR.TRE bit is set to 0 and the IMPLEMENTATION DEFINED mechanism has not been invoked.
• The implementation includes the Large Physical Address Extension, and the region is mapped as Device
memory.
• The Normal memory remapping or Device memory remapping of the S bit value for the entry makes the
region Non-shareable.
The NOSn fields in the PRRR are RAZ/WI if the implementation does not support the distinction between Inner
Shareable and Outer Shareable memory regions.
Note
The meaning of shareability attributes for Device memory is IMPLEMENTATION DEFINED for an implementation that
does not include the Large Physical Address Extension, and otherwise has no meaning. For more information, see
Shareable attribute for Device memory regions on page A3-134.
• The interpretation of the fields of the PRRR and NMRR registers can differ from the description given earlier
in this section.
VMSAv7 requires that the effect of these registers is limited to remapping the attributes of memory locations. These
registers must not change whether any cache hardware or MMUs are enabled. The mechanism by which the TEX
remap registers have an effect when the SCTLR.TRE bit is set to 0 is IMPLEMENTATION DEFINED. The ARMv7
architecture requires that from reset, if the IMPLEMENTATION DEFINED mechanism has not been invoked:
• If the PL1&0 stage 1 MMU is enabled and is using the Short-descriptor format translation tables, the
architecturally-defined behavior of the TEX[2:0], C, and B bits must apply, without reference to the TEX
remap functionality. In other words, memory attribute assignment must comply with the scheme described
in Short-descriptor format memory region attributes, without TEX remap on page B3-1363.
• If the PL1&0 stage 1 MMU is disabled, then the architecturally-defined behavior of the VMSA with MMUs
disabled must apply, without reference to the TEX remap functionality. See The effects of disabling MMUs
on VMSA behavior on page B3-1312.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1367
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
Possible mechanisms for enabling the IMPLEMENTATION DEFINED effect of the TEX remap registers when
SCTLR.TRE is set to 0 include:
• Changing the behavior when the PRRR and NMRR registers are changed from their IMPLEMENTATION
DEFINED reset values.
In addition, if the MMU is disabled and the SCTLR.TRE bit is set to 1, the architecturally-defined behavior of the
VMSA with the MMU disabled must apply without reference to the TEX remap functionality.
In an implementation that includes the Security Extensions, the IMPLEMENTATION DEFINED effect of these registers
must only take effect in the security state of the registers. See also The effect of the Security Extensions on TEX
remap.
Note
In a system that implements hardware management of the Access flag, a hardware Access flag update never changes
these bits.
Write accesses to the Secure copies of the TEX remap registers are disabled when the CP15SDISABLE input is
asserted HIGH, meaning the MCR operations to access these registers are UNDEFINED. For more information, see The
CP15SDISABLE input on page B3-1454.
B3-1368 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
For more information about the AttrIndx[2:0] descriptor field, see Attribute fields in stage 1 Long-descriptor Block
and Page descriptors on page B3-1338.
Table B3-14 SH[1:0] field encoding for Normal memory, Long-descriptor format
00 Non-shareable
01 UNPREDICTABLE
10 Outer Shareable
11 Inner Shareable
See Overlaying the shareability attribute on page B3-1373 for constraints on the Shareability attributes of a Normal
memory region that is Inner Non-cacheable, Outer Non-cacheable.
For a Device or Strongly-ordered memory region, the value of the SH[1:0] field of the translation table descriptor
is ignored.
Contiguous bit
The Long-descriptor translation table format descriptors contain a Contiguous bit. Setting this bit to 1 indicates that
16 adjacent translation table entries point to a contiguous output address range. These 16 entries must be aligned in
the translation table so that the top 5 bits of their input addresses, that index their position in the translation table,
are the same. For example, referring to Figure B3-21 on page B3-1350, to use this hint for a block of 16 entries in
the third-level translation table, bits[20:16] of the input addresses for the 16 entries must be the same.
The contiguous output address range must be aligned to size of 16 translation table entries at the same translation
table level.
Use of this bit means that the TLB can cache a single entry to cover the 16 translation table entries.
The architecture does not require a processor to cache TLB entries in this way. To avoid TLB coherency issues, any
TLB maintenance by address must not assume any optimization of the TLB tables that might result from use of this
bit.
Note
• This capability is similar to the approach used, in the Short-descriptor translation table format, for optimized
caching of Large Pages and Supersections in the TLB. However, an important difference in the Contiguous
bit capability is that TLB maintenance must be performed based on the size of the underlying translation table
entries, to avoid TLB coherency issues
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1369
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
IGNORED fields
For stage 1 and stage 2 Block and Page descriptors, the architecture defines bits[63:59] and bits[58:55] as IGNORED
fields, meaning the architecture guarantees that the processor hardware does not update these fields. In addition:
• Bits[58:55] are reserved for software use, see Field reserved for software use.
• In the stage 2 Block and Page descriptors, bits[63:60] are reserved for use by a System MMU.
The architecture reserves a 4-bit field in the Block and Page table descriptors, bits[58:55], for software use. In
considering migration from using the Short-descriptor format to the Long-descriptor format, this field is an
extension of the Short-descriptor field described in The OS managed translation table bits on page B3-1368.
Note
This means there is no need to invalidate the TLB if these bits are changed.
• The translation tables that control Non-secure PL2 stage 1 translations. These map VAs to PAs, and are
indicated and controlled by the HTTBR and HTCR.
These translations have exactly the same memory region attribute controls as any other stage 1 translations,
as described in Long-descriptor format memory region attributes on page B3-1368.
• The translation tables that control Non-secure PL1&0 stage 2 translations. These map the IPAs from the stage
1 translation onto PAs, and are indicated and controlled by the VTTBR and VTCR.
The descriptors in the virtualization translation tables define a second level of memory region attributes, that
are overlaid onto the attributes defined in the stage 1 translation. This section describes this overlaying of
attributes.
Long-descriptor translation table format descriptors on page B3-1335 describes the format of the entries in these
tables.
Note
In a virtualization implementation, a hypervisor might usefully:
• Reduce the permitted cacheability of a region.
• Increase the required shareability of a region.
The overlaying of attributes from stage 1 and stage 2 translations supports both of these options.
In the stage 2 translation table descriptors for memory regions and pages, the MemAttr[3:0] and SH[1:0] fields
describe the stage 2 memory region attributes:
• The definition of the stage 2 SH[1:0] field is identical to the same field for a stage 1 translation, see
Shareability, Long-descriptor format on page B3-1369.
B3-1370 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
• MemAttr[3:2] give a top-level definition of the memory type, and of the cacheability of a Normal memory
region, as Table B3-15 shows:
10 UNPREDICTABLE
11 UNPREDICTABLE
— When MemAttr[3:2]!= 0b00, indicating Normal memory, Table B3-17 shows the encoding of
MemAttr[1:0]:
00 UNPREDICTABLE
01 Inner Non-cacheable
Note
The stage 2 translation does not assign any allocation hints.
The following sections describe how the memory type attributes assigned at stage 2 of the translation are overlaid
onto those assigned at stage 1:
• Overlaying the memory type attribute on page B3-1372.
• Overlaying the cacheability attribute on page B3-1372.
• Overlaying the shareability attribute on page B3-1373.
Note
The following stage 2 translation table attribute settings leave the stage 1 settings unchanged:
• MemAttr[3:2] == 0b11, Normal memory, Outer Write-Back Cacheable.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1371
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
Table B3-18 Combining the stage 1 and stage 2 memory type assignments
See Overlaying the shareability attribute on page B3-1373 for information about:
• The shareability of a region for which the resultant type is Strongly-ordered or Device.
• The shareability requirements of a region with a resultant type of Normal for which the resultant cacheability,
described in Overlaying the cacheability attribute, is Inner Non-cacheable, Outer Non-cacheable.
The overlaying of the memory type attribute means a translation table walk for a stage 1 translation can be made to
Strongly-ordered or Device memory. This is likely to indicate a Guest OS error, and setting the HCR.PTW bit to 1
causes such an access to generate a Translation fault, see Stage 2 fault on a stage 1 translation table walk,
Virtualization Extensions on page B3-1399.
Note
Only Normal memory has a cacheability attribute.
B3-1372 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.8 Memory region attributes
For a memory region with a resultant memory type attribute of Normal, Table B3-20 shows how the stage 1 and
stage 2 shareability assignments are combined:
A memory region with a resultant memory type attribute of Normal, and a resultant cacheability attribute of Inner
Non-cacheable, Outer Non-cacheable, must have a resultant shareability attribute of Outer Shareable, otherwise
shareability is UNPREDICTABLE.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1373
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.9 Translation Lookaside Buffers (TLBs)
• The architecture has a concept of an entry locked down in the TLB. The method by which lockdown is
achieved is IMPLEMENTATION DEFINED, and an implementation might not support lockdown.
• The architecture does not guarantee that an unlocked TLB entry remains in the TLB.
• The architecture guarantees that a locked TLB entry remains in the TLB. However, a locked TLB entry might
be updated by subsequent updates to the translation tables. Therefore, when a change is made to the
translation tables, the architecture does not guarantee that a locked TLB entry remains incoherent with an
entry in the translation table.
• The architecture guarantees that a translation table entry that generates a Translation fault or an Access flag
fault is not held in the TLB. However a translation table entry that generates a Domain fault or a Permission
fault might be held in the TLB.
• Any translation table entry that does not generate a Translation or Access flag fault and is not out of context
might be allocated to an enabled TLB at any time. The only translation table entries guaranteed not to be held
in the TLB are those that generate a Translation or Access flag fault.
Note
An enabled TLB can hold translation table entries that do not generate a Translation fault but point to
subsequent tables in the translation table walk. This can be referred to as intermediate caching of TLB
entries.
• Software can rely on the fact that between disabling and re-enabling a stage of address translation, entries in
the TLB relating to that stage of translation have not have been corrupted to give incorrect translations.
nG == 0 The translation is global, meaning the region is available for all processes.
nG == 1 The translation is non-global, or process-specific, meaning it relates to the current ASID, as defined
by the CONTEXTIDR.
Each non-global region has an associated Address Space Identifier (ASID). These identifiers mean different
translation table mappings can co-exist in a caching structure such as a TLB. This means that software can create a
new mapping of a non-global memory region without removing previous mappings.
For a symmetric multiprocessor cluster where a single operating system is running on the set of processing elements,
ARMv7 requires all ASID values to be assigned uniquely within any single Inner Shareable domain. In other words,
each ASID value must have the same meaning to all processing elements in the system.
The translation regime used for accesses made at PL2 does not support ASIDs, and all pages are treated as global.
B3-1374 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.9 Translation Lookaside Buffers (TLBs)
When a processor is using the Long-descriptor translation table format, and is in Secure state, a translation must be
treated as non-global, regardless of the value of the nG bit, if NSTable is set to 1 at any level of the translation table
walk.
For more information see Control of Secure or Non-secure memory access, Long-descriptor format on
page B3-1340.
A particular case where the presence of the TLB can become visible is if the translation table entries that are in use
under a particular ASID and VMID are changed without suitable invalidation of the TLB. This is an issue regardless
of whether or not the translation table entries are global. In some cases, the TLB can hold two mappings for the same
address, and this might lead to UNPREDICTABLE behavior
For ARMv7:
• All TLBs are disabled from reset. All MMUs are disabled from reset, and the contents of the TLBs have no
effect on address translation. For more information see Enabling MMUs on page B3-1314.
• An implementation can require the use of a specific TLB invalidation routine, to invalidate the TLB arrays
before they are enabled after a reset. The exact form of this routine is IMPLEMENTATION DEFINED, but if an
invalidation routine is required it must be documented clearly as part of the documentation of the device.
ARM recommends that if an invalidation routine is required for this purpose, the routine is based on the
ARMv7 TLB maintenance operations described in TLB maintenance operations, not in Hyp mode on
page B4-1738.
• When TLBs that have not been invalidated by some mechanism since reset are enabled, the state of those
TLBs is UNKNOWN.
Similar rules apply:
• To cache behavior, see Behavior of the caches at reset on page B2-1267.
• To branch predictor behavior, see Behavior of the branch predictors at reset on page B2-1271.
• If TLB lockdown support is implemented, the lockdown mechanism is IMPLEMENTATION DEFINED. However,
key properties of the interaction of lockdown with the architecture must be documented as part of the
implementation documentation.
• In ARMv7, the TLB Type Register, TLBTR, does not define the lockdown scheme in use.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1375
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.9 Translation Lookaside Buffers (TLBs)
Note
This is a change from previous versions of the architecture, see CP15 c0, TLB Type ID Register, TLBTR,
ARMv6 on page D12-2514.
• A region of the CP15 c10 encodings is reserved for IMPLEMENTATION DEFINED TLB functions, such as TLB
lockdown functions. The reserved encodings are those with:
— <CRm> == {c0, c1, c4, c8}.
— All values of <opc2> and <opc1>.
See also IMPLEMENTATION DEFINED TLB control operations, VMSA on page B4-1745.
An implementation might use some of the CP15 c10 encodings that are reserved for IMPLEMENTATION DEFINED
TLB functions to implement additional TLB control functions. These functions might include:
• Unlock all locked TLB entries.
• Preload into a specific level of TLB. This is beyond the scope of the PLI and PLD hint instructions.
The Virtualization Extensions do not affect the TLB lockdown requirements. However, in a processor that
implements the Virtualization Extensions, exceptions generated by problems related to TLB lockdown, in a
Non-secure PL1 mode, can be routed to either:
• Non-secure Abort mode, using the Non-secure Data Abort exception vector.
• Hyp mode, using the Hyp Trap exception vector.
For more information, see Trapping accesses to lockdown, DMA, and TCM operations on page B1-1251.
An implementation can generate a TLB conflict abort if it detects that the address being looked up in the TLB hits
multiple entries. This can happen if the TLB has been invalidated inappropriately, for example if TLB invalidation
required by this manual has not been performed. If it happens, the resulting behavior is UNPREDICTABLE, but must
not permit access to regions of memory with permissions or attributes that mean they cannot be accessed in the
current Security state at the current privilege level.
In some implementations, multiple hits in the TLB can generate a synchronous Data Abort or Prefetch Abort
exception. In any case where this is possible it is IMPLEMENTATION DEFINED whether the abort is a stage 1 abort or
a stage 2 abort.
Note
A stage 2 abort cannot be generated if the Non-secure PL1&0 stage 2 MMU is disabled.
The priority of the TLB conflict abort is IMPLEMENTATION DEFINED, because it depends on the form of any TLB
that can generate the abort.
Note
The TLB conflict abort must have higher priority than any abort that depends on a value held in the TLB.
An implementation can generate TLB conflict aborts on either or both instruction fetches and data accesses.
On a TLB conflict abort, the fault address register returns the address that generated the fault. That is, it returns the
address that was being looked up in the TLB.
B3-1376 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
Note
This requirement applies to any translation table entry at any level of the translation tables, including an entry that
points to further levels of the tables, provided that the entry in that level of the tables does not cause a Translation
fault or Access flag fault
In addition to any TLB maintenance requirement, when changing the cacheability attributes of an area of memory,
software must ensure that any cached copies of affected locations are removed from the caches. For more
information, see Cache maintenance requirement created by changing translation table attributes on page B3-1391.
Because a TLB never holds any translation table entry that generates a Translation fault or an Access Flag fault, a
change from a translation table entry that causes a Translation or Access flag fault to one that does not fault, does
not require any TLB or branch predictor invalidation.
Special considerations can apply to translation table updates that change the memory type, cacheability, or output
address of an entry, see Using break-before-make when updating translation table entries on page B3-1378.
In addition, software must perform TLB maintenance after updating the system control registers if the updates mean
that the TLB might hold information that applies to a current translation context, but is no longer valid for that
context. Maintenance requirements on changing system control register values on page B3-1381 gives more
information about this maintenance requirement.
Each of the translation regimes defined in Figure B3-1 on page B3-1307 is a different context, and:
• For the Non-secure PL1&0 regime, a change in the VMID or ASID value changes the context.
• For the Secure PL1&0 regime, a change in the ASID value changes the context.
For operation in Non-secure PL1&0 modes, a change of HCR.VM, unless made at the same time as a change of
VMID, requires the invalidation of all TLB entries for the Non-secure PL1&0 translation regime that apply to the
current VMID. Otherwise, there is no guarantee that the effect of the change of HCR.VM is visible to software
executing in the Non-secure PL1&0 modes.
Any TLB operation can affect any other TLB entries that are not locked down.
The architecture defines CP15 c8 functions for TLB maintenance operations, and supports the following operations:
• Invalidate all unlocked entries in the TLB.
• Invalidate a single TLB entry, by MVA, or MVA and ASID for a non-global entry.
• Invalidate all TLB entries that match a specified ASID.
A TLB maintenance operation that specifies a virtual address that would generate any MMU abort, including a
virtual address that is not in the range of virtual addresses that can be translated, does not generate an abort.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1377
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
• Invalidate all TLB entries that match a specified MVA, regardless of the ASID.
• Operations that apply across multiprocessors in the same Inner Shareable domain, see Multiprocessor effects
on TLB maintenance operations on page B3-1385.
Note
An address-based TLB maintenance operation that applies to the Inner Shareable domain does so regardless of the
Shareability attributes of the address supplied as an argument to the operation.
The Virtualization Extensions include additional TLB maintenance operations for use at PL2, and have some
implications for the effect of the other TLB maintenance operations, see The scope of TLB maintenance operations
on page B3-1385.
In an implementation that includes the Security Extensions, the TLB operations take account of the current security
state, as part of the address translation required for the TLB operation.
Some TLB operations are defined as operating only on instruction TLBs, or only on data TLBs. ARMv7 includes
these operations for backwards compatibility, and more recent TLB operations do not support this distinction. From
the introduction of ARMv7, ARM deprecates any use of Instruction TLB operations, or of Data TLB operations,
and developers must not rely on this distinction being maintained in future versions of the ARM architecture.
The ARM architecture does not dictate the form in which the TLB stores translation table entries. However, for TLB
invalidate operations, the minimum size of the table entry that is invalidated from the TLB must be at least the size
that appears in the translation table entry.
Note
In an implementation that includes the Large Physical Address Extension and is using the Long-descriptor
translation table format, the Contiguous bit does not affect the minimum size of entry that must be invalidated from
the TLB
TLB maintenance operations, not in Hyp mode on page B4-1738 describes these operations.
• A change of the output address (OA), if the OA of at least one of the old translation table entry and the new
translation table entry is writable.
A break-before-make approach on changing from an old translation table entry to a new translation table entry
requires the following steps:
1. Replace the old translation table entry with an invalid entry, and execute a DSB instruction.
2. Invalidate the translation table entry with a broadcast TLB invalidation instruction, and execute a DSB
instruction to ensure the completion of that invalidation.
3. Write the new translation table entry, and execute a DSB instruction to ensure that the new entry is visible.
This sequence ensures that at no time are both the old and new entries simultaneously visible to different threads of
execution. This means the problems described at the start of this subsection cannot arise.
B3-1378 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
• The effect on locked entries of the TLB invalidate all unlocked entries and TLB invalidate by MVA all ASID
operations is IMPLEMENTATION DEFINED. However, these operations must implement one of the following
options:
— Have no effect on entries that are locked down.
— Generate an IMPLEMENTATION DEFINED Data Abort exception if an entry is locked down, or might be
locked down. The CP15 c5 fault status register definitions include a fault code for cache and TLB
lockdown faults, see Table B3-23 on page B3-1412 for the codes used with the Short-descriptor
translation table formats, or Table B3-24 on page B3-1413 for the codes used with the Long-descriptor
translation table formats.
In an implementation that includes the Virtualization Extensions, if HCR.TIDCP is set to 1, any such
exceptions taken from a Non-secure PL1 mode are routed to Hyp mode, see Trapping accesses to
lockdown, DMA, and TCM operations on page B1-1251.
This permits a usage model for TLB invalidate routines, where the routine invalidates a large range of
addresses, without considering whether any entries are locked in the TLB.
• The effect on locked entries of the TLB invalidate by MVA and invalidate by ASID match operations is
IMPLEMENTATION DEFINED. However, the implementation must be one of the following:
Note
Any implementation that uses an abort mechanism for entries that can be locked down but are not actually locked
down must:
• Document the IMPLEMENTATION DEFINED instruction sequences that perform the required operations on
entries that are not locked down.
• Implement one of the other specified alternatives for the locked entries.
ARM recommends that, when possible, such IMPLEMENTATION DEFINED instruction sequences use the
architecturally-defined operations. This minimizes the number of customized operations required.
In addition, an implementation that uses an abort mechanism for handling TLB maintenance operations on entries
that can be locked down but are not actually locked down must also must provide a mechanism that ensures that no
TLB entries are locked.
Similar rules apply to cache lockdown, see The interaction of cache lockdown with cache maintenance operations
on page B2-1286.
The architecture does not guarantee that any unlocked entry in the TLB remains in the TLB. This means that, as a
side-effect of a TLB maintenance operation, any unlocked entry in the TLB might be invalidated.
• A TLB invalidate operation is complete when all memory accesses using the invalidated TLB entries have
been observed by all observers, to the extent that those accesses must be observed. The shareability and
cacheability of the accessed memory locations determine the extent to which the accesses must be observed.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1379
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
In addition, once the TLB invalidate operation is complete, no new memory accesses that can be observed
by those observers will be performed using the invalidated TLB entries.
For a TLB invalidate operation that affects other processors, the set of memory accesses that have been
observed when the TLB maintenance operation is complete.must include the memory accesses from those
processes that used the invalidated TLB entries.
• A TLB maintenance operation is only guaranteed to be complete after the execution of a DSB instruction.
• An ISB instruction, or a return from an exception, causes the effect of all completed TLB maintenance
operations that appear in program order before the ISB or return from exception to be visible to all subsequent
instructions, including the instruction fetches for those instructions.
• An exception causes all completed TLB maintenance operations, that appear in the instruction stream before
the point where the exception was taken, to be visible to all subsequent instructions, including the instruction
fetches for those instructions.
• All TLB Maintenance operations are executed in program order relative to each other.
• The execution of a Data or Unified TLB maintenance operation is only guaranteed to be visible to a
subsequent explicit load or store operation after both:
— The execution of a DSB instruction to ensure the completion of the TLB operation.
— Execution of a subsequent context synchronization operation.
• The execution of an Instruction or Unified TLB maintenance operation is only guaranteed to be visible to a
subsequent instruction fetch after both:
— The execution of a DSB instruction to ensure the completion of the TLB operation.
— Execution of a subsequent context synchronization operation.
The following rules apply when writing translation table entries. They ensure that the updated entries are visible to
subsequent accesses and cache maintenance operations.
For TLB maintenance, the translation table walk is treated as a separate observer. This means:
• A write to the translation tables, after it has been cleaned from the cache if appropriate, is only guaranteed to
be seen by a translation table walk caused by an explicit load or store after the execution of both a DSB and an
ISB.
However, the architecture guarantees that any writes to the translation tables are not seen by any explicit
memory access that occurs in program order before the write to the translation tables.
• For an ARMv7 implementation that does not include the Multiprocessing Extension, and in implementations
of architecture versions before ARMv7, if the translation tables are held in Write-Back Cacheable memory,
the caches must be cleaned to the point of unification after writing to the translation tables and before the DSB
instruction. This ensures that the updated translation tables are visible to a hardware translation table walk.
• A write to the translation tables, after it has been cleaned from the cache if appropriate, is only guaranteed to
be seen by a translation table walk caused by the instruction fetch of an instruction that follows the write to
the translation tables after both a DSB and an ISB.
Therefore, an example instruction sequence for writing a translation table entry, covering changes to the instruction
or data mappings in a uniprocessor system is:
STR rx, [Translation table entry] ; write new entry to the translation table
Clean cache line [Translation table entry] : This operation is not required with the
; Multiprocessing Extensions.
DSB ; ensures visibility of the data cleaned from the D Cache
Invalidate TLB entry by MVA (and ASID if non-global) [page address]
Invalidate BTC
DSB ; ensure completion of the Invalidate TLB operation
ISB ; ensure table changes visible to instruction fetch
B3-1380 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
• Any change to the SCTLR.AFE bit, see Changing the Access flag enable.
• In an implementation that includes the Large Physical Address Extension, changing TTBCR.EAE, see
Changing the current Translation table format on page B3-1382.
Note
There is no enable bit for use of the Access flag when using the Long-descriptor translation table format.
Changing HCR.PTW
When the Protected table walk bit, HCR.PTW, is set to 1, a stage 1 translation table access in the Non-secure PL1&0
translation regime, to an address that is mapped to Device or Strongly-ordered memory by its stage 2 translation,
generates a stage 2 Permission fault. A TLB associated with a particular VMID might hold entries that depend on
the effect of HCR.PTW. Therefore, if the value of HCR.PTW is changed without a change to the VMID value, all
TLB entries associated with the current VMID must be invalidated before executing software in a Non-secure PL1
or PL0 mode. If this is not done, behavior is UNPREDICTABLE.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1381
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
• Non-secure PL1&0 stage 1 address translations. This means that all of the following registers must change
atomically:
— PRRR and NMRR, if using the Short-descriptor translation table format.
— MAIR0 and MAIR1, if using the Long-descriptor translation table format.
— TTBR0, TTBR1, TTBCR, DACR, and CONTEXTIDR.
— The SCTLR.
• Non-secure PL1&0 stage 2 address translations. This means that all of the following registers and register
fields must change atomically:
— VTTBR and VTCR.
— HMAIR0 and HMAIR1.
— The HSCTLR.
Note
Only some bits of SCTLR affect the stage 1 translation, and only some bits of HSCTLR affect the stage 2 translation.
However, in each case, changing these bits requires a write to the register, and that write must be atomic with the
other register updates.
These registers apply to execution in Non-secure PL1&0 modes. However, when updated as part of a switch of
virtual machines they are updated by software executing in Hyp mode. This means the registers are out of context
when they are updated, and no synchronization precautions are required.
Note
By contrast, a translation table change associated with a change of ASID, made by software executing at PL1, can
require changes to registers that are in context. Synchronization of changes of ASID and TTBR describes appropriate
precautions for such a change.
The Virtualization Extensions require that when an implementation is in Hyp mode, or in Secure state, the registers
associated with the Non-secure PL1&0 translation regime must not be used for speculative memory accesses.
Note
This does not imply that on taking an exception to Hyp or Monitor mode that translation table walks before the
exception will be completed by the time the entry into Hyp or Monitor mode, and this might include the translation
table walks for those accesses being performed in effect speculatively. A DSB will ensure that these memory accesses
are complete.
B3-1382 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
translation table base address, meaning these two values cannot be updated atomically. Since a processor can
perform a speculative memory access at any time, this lack of atomicity is a problem that software must address.
Such a change is complicated by:
• The depth of speculative fetch being IMPLEMENTATION DEFINED.
• The use of branch prediction.
When using the Short-descriptor translation table format, the virtual memory management operations must ensure
the synchronization of changes of the ContextID and the translation table registers. For example, some or all of the
TLBs, branch predictors, and other caching of ASID and translation information might become corrupt with invalid
translations. Synchronization is necessary to avoid either:
• The old ASID being associated with translation table walks from the new translation tables.
• The new ASID being associated with translation table walks from the old translation tables.
There are a number of possible solutions to this problem, and the most appropriate approach depends on the system.
Example B3-3, Example B3-4, and Example B3-5 on page B3-1384 describe three possible approaches.
Note
Another instance of the synchronization problem occurs if a branch is encountered between changing the ASID and
performing the synchronization. In this case the value in the branch predictor might be associated with the incorrect
ASID. Software can address this possibility using any of these approaches, but might, instead, be written to avoid
such branches.
Example B3-3 Using a reserved ASID to synchronize ASID and TTBR changes
In this approach, a particular ASID value is reserved for use by the operating system, and is used only for the
synchronization of the ASID and Translation table base register. This example uses the value of 0 for this purpose,
but any value could be used.
This approach can be used only when the size of the mapping for any given virtual address is the same in the old
and new translation tables.
The maintenance software uses the following sequence, that must be executed from memory marked as global:
Change ASID to 0
ISB
Change Translation Table Base Register
ISB
Change ASID to new value
This approach ensures that any non-global pages fetched at a time when it is uncertain whether the old or new
translation tables are being accessed are associated with the unused ASID value of 0. Since the ASID value of 0 is
not used for any normal operations these entries cannot cause corruption of execution.
Example B3-4 Using translation tables containing only global mappings when changing the ASID
A second approach involves switching the translation tables to a set of translation tables that only contain global
mappings while switching the ASID.
The maintenance software uses the following sequence, that must be executed from memory marked as global:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1383
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
This approach ensures that no non-global pages can be fetched at a time when it is uncertain whether the old or new
ASID value will be used.
This approach works without the need for TLB invalidations in systems that have caching of intermediate levels of
translation tables, as described in General TLB maintenance requirements on page B3-1377, provided that the
translation tables containing only global mappings have only level 1 translation table entries of the following kinds:
• Pointers to level 2 tables that hold only global entries, and that are the same level 2 tables that are used for
accessing global entries by both:
— The set of translation tables that were used under the old ASID value.
— The set of translation tables that will be used with the new ASID value.
In addition, all sets of translation tables in this example should have the same shareability and cacheability
attributes, as held in the TTBR0.{ORGN, IRGN} or TTBR1.{ORGN, IRGN} fields.
If these rules are not followed, then the implementation might cache level 1 translation table entries that require
explicit invalidation.
In systems where only the translation tables indexed by TTBR0 hold non-global mappings, maintenance software
can use the TTBCR.PD0 field to disable use of TTBR0 during the change of ASID. This means the system does not
require a set of global-only mappings.
The maintenance software uses the following sequence, that must be executed from a memory region with a
translation that is accessed using the base address in the TTBR1 register, and is marked as global:
Set TTBCR.PD0 = 1
ISB
Change ASID to new value
Change Translation Table Base Register to new value
ISB
Set TTBCR.PD0 = 0
This approach ensures that no non-global pages can be fetched at a time when it is uncertain whether the old or new
ASID value will be used.
When using the Long-descriptor translation table format, TTBCR.A1 holds the number, 0 or 1, of the TTBR that
holds the current ASID. This means the current Translation Table Base Register can also hold the current ASID, and
the current translation table base address and ASID can be updated atomically when:
• TTBR0 is the only Translation Table Base Register being used. TTBCR.A1 must be set to 0.
• TTBR0 points to the only translation tables that hold non-global entries, and TTBCR.A1 is set to 0.
• TTBR1 points to the only translation tables that hold non-global entries, and TTBCR.A1 is set to 1.
In these cases, software can update the current translation table base address and ASID atomically, by updating the
appropriate TTBR, and does not require a specific routine to ensure synchronization of the change of ASID and base
address.
However, in all other cases using the Long-descriptor format, the synchronization requirements are identical to
those when using the Short-descriptor formats, and the examples in this section indicate how synchronization might
be achieved.
B3-1384 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
Note
When using the Long-descriptor translation table format, CONTEXTIDR.ASID has no significance for address
translation, and is only an extension of CONTEXTIDR.
The ARMv7 Multiprocessing Extensions are an OPTIONAL set of extensions that improve the implementation of a
multiprocessor system. These extensions provide additional TLB maintenance operations that apply to the TLBs of
processors in the same Inner Shareable domain.
Note
The Multiprocessing Extensions can be implemented in a uniprocessor system with no hardware support for cache
coherency. In such a system, the Inner Shareable domain applies only to the single processor, and all instructions
defined to apply to the Inner Shareable domain behave as aliases of the local operations.
The architecture permits the caching of any translation table entry that has been returned from memory without a
fault and that does not, itself, cause a Translation Fault or an Access Flag fault. This means the TLB:
• Cannot hold an entry that, when used for a translation table lookup, causes a Translation Fault or an Access
Flag fault.
• Can hold an entry for a translation table lookup for a translation that causes a Translation Fault or an Access
Flag fault at a subsequent level of translation table lookup. For example, it can hold an entry for the first level
lookup of a translation that causes a a Translation Fault or an Access Flag fault at the second or third level of
lookup.
Such entries might be held in intermediate TLB caching structures that are distinct from the data caches, in that they
are not required to be invalidated as the result of writes of the data. The architecture makes no restriction on the form
of these intermediate TLB caching structures.
The architecture does not intend to restrict the form of TLB caching structures used for holding translation table
entries, and in particular for translation regimes that involve two stages of translation, it recognizes that such
caching structures might contain:
• At any level of the translation table walk, entries containing information from stage 1 translation table entries.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1385
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
Where a TLB maintenance operation is required to apply to stage 1 entries, then it must apply to any cached entry
in the caching structures that includes any stage 1 information that would be used to translate the address being
invalidated, including any entry that combines information from both stage 1 and stage 2 translation table entries.
Where a TLB maintenance operation is required to apply to stage 2 entries it must apply to any cached entry in the
caching structures that includes any information from stage 2 translation table entries, including any entry that
combines information from both stage 1 and stage 2 translation table entries.
Table B3-21 on page B3-1387 summarizes the required effect of the preferred TLB operations that operate only on
TLBs on the processor that executes the instruction. Additional TLB operations:
• In an implementation that includes the Multiprocessing Extensions, apply across all processors in the same
Inner Shareable domain. In such an implementation, each operation shown in the table has an Inner Shareable
equivalent, identified by an IS suffix. For example, the Inner Shareable equivalent of TLBIALL is
TLBIALLIS. See also Virtualization Extensions upgrading of TLB maintenance operations on
page B3-1388.
• Can apply to separate Instruction or Data TLBs, as indicated by a footnote to the table. ARM deprecates any
use of these operations.
Note
• The architecture permits a TLB invalidation operation to affect any unlocked entry in the TLB. Table B3-21
on page B3-1387 defines only the entries that each operation must invalidate.
• All TLB operations, including those that operate on an MVA match, operate regardless of the value of
SCTLR.M.
Related operations Each operation description applies also to any equivalent operation that either:
• Applies to all processors in the same Inner Shareable domain.
• Applies only to a data TLB, or only to an instruction TLB.
So, for example, the TLBIALL description applies also to TLBIALLIS, ITLBIALL, and
DTLBIALL.
Matches the MVA Means the MVA argument for the operation must match the MVA value in the TLB entry.
Matches the ASID Means the ASID argument for the operation must match the ASID in use when the TLB
entry was assigned.
Execution at PL2 Descriptions of operations at PL2 apply only to an implementation that includes the
Virtualization Extensions.
B3-1386 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
For the definitions of the translation regimes referred to in the table, see About the VMSA on page B3-1306.
Executed from
Operation Effect, must invalidate any entry that matches all stated conditions
State Mode
TLBIALL a, b Secure PL1 All entries for the Secure PL1&0 translation regime. That is, any entry that was
allocated in Secure state.
Non-secure PL1 All entries for stage 1 of the Non-secure PL1&0 translation regime that match the
current VMID.
PL2 All entries for stage 1 or stage 2 of the Non-secure PL1&0 translation regime that
match the current VMID.
TLBIMVA a, b Secure PL1 Any entry for the Secure PL1&0 translation regime that both:
• Matches the MVA argument.
• Matches the ASID argument, or is global.
Non-secure PL1 or Any entry for stage 1 of the Non-secure PL1&0 translation regime for which all of
PL2 the following apply. The entry:
• Matches the MVA argument.
• Matches the ASID argument, or is global.
• Matches the current VMID.
TLBIASID a, b Secure PL1 Any entry for the Secure PL1&0 translation regime that is non-global and matches
the ASID argument.
Non-secure PL1 or Any entry for stage 1 of the Non-secure PL1&0 translation regime that both:
PL2 • Is not global and matches the ASID argument.
• Matches the current VMID.
TLBIMVAA a Secure PL1 Any entry for the Secure PL1&0 translation regime that matches the MVA argument.
Non-secure PL1 or Any entry for stage 1 of the Non-secure PL1&0 translation regime that both:
PL2 • Matches the MVA argument.
• Matches the current VMID.
TLBIALLNSNH c Secure Monitor All entries for stage 1 or stage 2 of the Non-secure PL1&0 translation regime,
regardless of the associated VMID.
Non-secure PL2
TLBIALLH c Secure Monitor All entries for the Non-secure PL2 translation regime. That is, any entry that was
allocated in Non-secure state at PL2.
Non-secure PL2
TLBIMVAH c Secure Monitor Any entry for the Non-secure PL2 translation regime that matches the MVA
argument.
Non-secure PL2
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1387
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.10 TLB maintenance requirements
B3-1388 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.11 Caches in a VMSA implementation
Maintaining this level of abstraction is difficult when describing the relationship between memory address
translation and caches, especially regarding the indexing and tagging policy of caches. This section:
• Summarizes the architectural requirements for the interaction between caches and memory translation.
• Gives some information about the likely implementation impact of the required behavior.
In addition, Cache maintenance requirement created by changing translation table attributes on page B3-1391
describes the cache maintenance required after updating the translation tables to change the attributes of an area of
memory.
• About ARMv7 cache and branch predictor maintenance functionality on page B2-1272. This section
describes the ARMv7 cache maintenance operations, that apply to both PMSA and VMSA implementations.
• Cache maintenance operations, functional group, VMSA on page B3-1491. This section summarizes the
CP15 encodings used for these operations.
This means that the behavior of accesses from the same observer to different VAs, that are translated to the same PA
with the same memory attributes, is fully coherent. This means these accesses behave as follows, regardless of
which VA is accessed:
• A read of a PA returns the value of the last successful write to that PA.
• A write to a PA that occurs, in program order, after a read of that PA, has no effect on the value returned by
that read.
The memory system behaves in this way without any requirement to use barrier or cache maintenance operations.
In addition, if cache maintenance is performed on a memory location, the effect of that cache maintenance is visible
to all aliases of that physical memory location.
These properties are consistent with implementing all caches that can handle data accesses as Physically-indexed,
physically-tagged (PIPT) caches.
The ARMv7 architecture supports three different behaviors for instruction caches. For ease of reference and
description these are identified by descriptions of the associated expected implementation, as follows:
• PIPT instruction caches.
• Virtually-indexed, physically-tagged (VIPT) instruction caches.
• ASID and VMID tagged Virtually-indexed, virtually-tagged (VIVT) instruction caches.
The CTR identifies the form of the instruction caches, see CTR, Cache Type Register, VMSA on page B4-1552.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1389
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.11 Caches in a VMSA implementation
The following subsections describe the behavior associated with these cache types, including any occasions where
explicit cache maintenance is required to make the use of memory address translation transparent to the instruction
cache:
• PIPT instruction caches.
• VIPT instruction caches.
• ASID and VMID tagged VIVT instruction caches.
Note
For software to be portable between implementations that might use any of PIPT instruction caches, VIPT
instruction caches, or ASID and VMID tagged VIVT instruction caches, the software must invalidate the instruction
cache whenever any condition occurs that would require instruction cache maintenance for at least one of the
instruction cache types.
An implementation that provides PIPT instruction caches implements the IVIPT extension, see IVIPT architecture
extension on page B3-1391.
Note
Cache invalidation is the only cache maintenance operation that can be performed on an instruction cache.
If instruction cache invalidation by address is performed on a memory location, the effect of that invalidation is
visible only to the virtual address supplied with the operation. The effect of the invalidation might not be visible to
any other aliases of that physical memory location.
The only architecturally-guaranteed way to invalidate all aliases of a physical address from a VIPT instruction cache
is to invalidate the entire instruction cache.
An implementation that provides VIPT instruction caches implements the IVIPT extension, see IVIPT architecture
extension on page B3-1391.
• Any change to the TTBR0, TTBR1, or TTBCR registers, unless accompanied by a change to the ASID, or a
change to the VMID.
B3-1390 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.11 Caches in a VMSA implementation
• Changes to the VTTBR or VTCR registers, unless accompanied by a change to the VMID.
Note
For ASID and VMID tagged VIVT instruction caches only, invalidation is not required if a change to the translations
is such that the instructions associated with the non-faulting translations of a virtual address, for a given translation
regime and a given ASID and VMID, as appropriate, remain unchanged through the change of translation even if
the physical locations being mapped to by the change of translation have been written as part of changing the
translation.
This does not apply for VIPT or PIPT instruction caches as those hold copies of physical addresses, and so must be
invalidated when the contents are written to, to avoid using stale entries.
If instruction cache invalidation by address is performed on a memory location, the effect of that invalidation is
visible only to the virtual address supplied with the operation. The effect of the invalidation might not be visible to
any other aliases of that physical memory location.
The only architecturally-guaranteed way to invalidate all aliases of a physical address from an ASID and VMID
tagged VIVT instruction cache is to invalidate the entire instruction cache.
The formal definition of the IVIPT extension to the ARMv7 architecture is that it reduces the instruction cache
maintenance requirement to the following condition:
• Instruction cache maintenance is required only after writing new data to a physical address that holds an
instruction.
The cache clean and invalidate avoids any possible coherency errors caused by mismatched memory attributes.
Similarly, to avoid possible coherency errors caused by mismatched memory attributes, the following sequence
must be followed when changing the shareability attributes of a cacheable memory location:
1. Make the memory location Non-cacheable, Outer Shareable.
2. Clean and invalidate the location from them cache.
3. Change the shareability attributes to the required new values.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1391
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Debug exception An exception caused by the debug configuration, see About debug exceptions on
page C4-2076.
Alignment fault An Alignment fault is generated if the address used for a memory access does not have the
required alignment for the operation. For more information, see Unaligned data access on
page A3-106 and Alignment faults on page B3-1399.
MMU fault An MMU fault is a fault generated by the fault checking sequence for the current translation
regime.
External abort Any memory system fault other than a Debug exception, an Alignment fault, or an MMU
fault.
Collectively, these mechanisms are called aborts. Chapter C4 Debug Exceptions describes Debug exceptions, and
the remainder of this section describes Alignment faults, MMU faults, and External aborts.
Note
The Prefetch Abort exception applies to any synchronous memory abort on an instruction fetch. It is not restricted
to speculative instruction fetches.
In the ARM architecture, asynchronous memory aborts are a type of External abort, and are treated as a special type
of Data Abort exception.
Note
The introduction of the Large Physical Address Extension changes some aspects of the terminology used for
describing MMU faults, and this section uses the new terminology throughout. For more information, see VMSAv7
MMU fault terminology on page B3-1395.
An access that causes an abort is said to be aborted, and uses the Fault Address Registers (FARs) and Fault Status
Registers (FSRs) to record context information. For more information about the FARs and FSRs, see Exception
reporting in a VMSA implementation on page B3-1406.
B3-1392 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Note
• Although the referenced section mostly describes the routing of asynchronous exceptions, it
includes the SCR.EA control that applies to both synchronous and asynchronous external
aborts.
• The SCR is implemented only as part of the Security Extensions.
Note
The only memory aborts that can be routed to Monitor mode are External aborts.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1393
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
— The processor was executing in the Non-secure PL0 mode when it took the exception,
the abort is synchronous, and HCR.TGE is set to 1. For more information see
Synchronous external abort, when HCR.TGE is set to 1 on page B1-1192.
— The abort occurred on a stage 2 translation table walk.
• Debug exceptions, if HDCR.TDE is set to 1. For more information, see Routing Debug
exceptions to Hyp mode on page B1-1193.
When the processor is in a Non-secure mode other than Hyp mode, if multiple factors cause an Alignment fault, the
abort is taken to Non-secure Abort mode if any of the factors require the abort to be taken to Abort mode. For
example, if the SCTLR.A bit is set to 1, and the access is an unaligned access to an address that the stage 2
translation tables mark as Strongly-ordered, then the abort is taken to Non-secure Abort mode.
B3-1394 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Third level Access flag fault - Long-descriptor translation table format only.
First level Domain fault Section Domain fault Short-descriptor translation table format only, except for reporting faults
on address translation operations in the 64-bit PAR, see Determining the
Second level Domain fault Page Domain fault PAR format, Large Physical Address Extension on page B3-1437.
Cannot occur at third level.
In an implementation that includes the Virtualization Extensions, MMU faults are also classified by the translation
stage at which the fault is generated. This means that a memory access from a Non-secure PL1 or PL0 mode can
generate:
• A stage 1 MMU fault, for example, a stage 1 Translation fault.
• A stage 2 MMU fault, for example, a stage 2 Translation fault.
For more information about Prefetch Abort exceptions and Data Abort exceptions, see Exception handling on
page B1-1164.
In a VMSA implementation, all memory accesses require VA to PA translation. Therefore, when a corresponding
MMU is enabled, each access requires a lookup of the translation table descriptor for the accessed VA. For more
information, see Translation tables on page B3-1316 and subsequent sections of this chapter. MMU fault checking
is performed for each level of translation table lookup. If an implementation includes the Virtualization Extensions
and is operating in Non-secure state, MMU fault checking is performed for each stage of address translation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1395
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Note
For a processor that includes the Virtualization Extensions, operating in Non-secure state, the operating system or
similar Non-secure system software defines the stage 1 translation tables in the IPA address space, and typically is
unaware of the stage 2 translation, from IPA to PA. However, each Non-secure translation table access is subject to
stage 2 address translation, and might be faulted at that stage.
The MMU fault checking sequence is largely independent of the translation table format, as the figures in this
section show. The differences are:
The fault-checking sequence shows a translation from an Input address to an Output address. For more information
about this terminology, see About address translation on page B3-1309.
Note
The descriptions in this section do not include the possibility that the attempted address translation generates a TLB
conflict abort, as described in TLB conflict aborts on page B3-1376.
MMU faults on page B3-1400 describes the faults that an MMU fault-checking sequence can report.
Figure B3-23 on page B3-1397 shows the process of fetching a descriptor from the translation table. For the
top-level fetch for any translation, the descriptor is fetched only if the input address passes any required alignment
check. As the figure shows, in an implementation that includes the Virtualization Extensions, if the translation is
stage 1 of the Non-secure PL1&0 translation regime, then the descriptor address is in the IPA address space, and is
subject to a stage 2 translation to obtain the required PA. This stage 2 translation requires a recursive entry to the
fault checking sequence.
B3-1396 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Descriptor address
Is this address an IPA for a
Non-secure PL0 or PL1 access?
Translate address.
Translation Descriptor address is input
Yes
required address for stage 2
? translation
A1
No
A2
Returns descriptor PA
Fetch descriptor
External abort
External Yes on translation
abort? table walk
No
Return descriptor
Figure B3-24 on page B3-1398 shows the full VMSA fault checking sequence, including the alignment check on
the initial access.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1397
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
No Alignment
No Misaligned Yes
? fault
Fetch descriptor ‡
Descriptor Translation
No
valid? fault
Short Domain
Yes No access Yes
descriptors fault
domain
?
?
No No
Manager
domain
Client
Yes domain No
Check access permissions ?
* V.Exts. = Virtualization
Extensions
Permission
‡ See Fetching the descriptor Violation Yes
fault
flowchart ?
† Links to and from Fetching the No
descriptor flowchart
Output address A2†
B3-1398 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Note
In a virtualized system, typically, a Guest OS operating in a Non-secure PL1 mode defines the translation tables and
translation table register entries controlling the Non-secure PL1&0 stage 1 translations. A Guest OS has no
awareness of the stage 2 address translation, and therefore believes it is specifying translation table addresses in the
physical address space. However, it actually specifies these addresses in its IPA space. Therefore, to support
virtualization, translation table addresses for the Non-secure PL1&0 stage 1 translations are always defined in the
IPA address space.
On performing a translation table walk for the stage 1 translations, the descriptor addresses must be translated from
IPA to PA, using a stage 2 translation. This means that a memory access made as part of a stage 1 translation table
lookup might generate, on a stage 2 translation:
• A Translation fault, Access flag fault, or Permission fault.
• A synchronous external abort on the memory access.
If SCR.EA is set to 1, a synchronous external abort is taken to Secure Monitor mode. Otherwise, these faults are
reported as stage 2 memory aborts. HSR.ISS[7] is set to 1, to indicate a stage 2 fault during a stage 1 translation
table walk, and the part of the ISS field that might contain details of the instruction is invalid. For more information
see Use of the HSR on page B3-1421.
Alternatively, a memory access made as part of a stage 1 translation table lookup might target an area of memory
with the Device or Strongly-ordered attribute assigned on the stage 2 translation of the address accessed. When the
HCR.PTW bit is set to 1, such an access generates a stage 2 Permission fault.
Note
• On most systems, such a mapping to Strongly-ordered or Device memory on the stage 2 translation is likely
to indicate a Guest OS error, where the stage 1 translation table is corrupted. Therefore, it is appropriate to
trap this access to the hypervisor.
A TLB might hold entries that depend on the effect of HCR.PTW. Therefore, if HCR.PTW is changed without
changing the current VMID, the TLBs must be invalidated before executing in a Non-secure PL1 or PL0 mode. For
more information, see Changing HCR.PTW on page B3-1381.
A cache maintenance operation performed from a Non-secure PL1 mode can cause a stage 1 translation table walk
that might generate a stage 2 Permission fault, as described in this section. This is an exception to the general rule
that a cache maintenance operation cannot generate a Permission fault.
An Alignment fault can occur on an access for which the MMU is disabled.
In an implementation that includes the Virtualization Extensions, any unaligned access to memory region with the
Device or Strongly-ordered memory type attribute generates an Alignment fault.
Note
• In versions of the ARMv7 architecture before the introduction of the Virtualization Extensions, the behavior
of an unaligned access to Device or Strongly-ordered memory is architecturally UNPREDICTABLE. Most
implementations generate an abort on such an access.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1399
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
• In some documentation, including issues A and B of this manual, Alignment faults are classified as a type of
MMU fault. However, the behavior of Alignment faults differs, in a number of ways, from the behavior of
MMU faults. This change in the classification of Alignment faults has no effect on their behavior.
Routing of aborts on page B3-1393 defines the mode to which an Alignment fault is taken.
In an implementation that includes the Virtualization Extensions, the prioritization of Alignment faults depends on
whether the fault was generated because of an access to Device or Strongly-ordered memory, or for another reason.
For more information, see Prioritization of aborts on page B3-1404.
MMU faults are always synchronous. For more information, see Terminology for describing exceptions on
page B1-1136.
When an MMU fault generates an abort for a region of memory, no memory access is made if that region is or could
be marked as Strongly-ordered or Device.
The following subsections describe the MMU faults that might be detected during a fault checking sequence:
• External abort on a translation table walk
• Translation fault
• Access flag fault on page B3-1401
• Domain fault, Short-descriptor format translation tables only on page B3-1401
• Permission fault on page B3-1402.
Translation fault
A Translation fault can be generated at any level of lookup, and the reported fault code identifies the lookup level.
A Translation fault is generated if bits[1:0] of a translation table descriptor identify the descriptor as either a Fault
encoding or a reserved encoding. For more information see:
• Short-descriptor translation table format descriptors on page B3-1322
• Long-descriptor translation table format descriptors on page B3-1335.
In addition, if an implementation includes the Virtualization Extensions, then a Translation fault is generated if the
input address for a translation either does not map on to an address range of a Translation Table Base Register, or
the Translation Table Base Register range that it maps on to is disabled. In these cases the fault is reported as a first
level Translation fault on the translation stage at which the mapping to a region described by a Translation Table
Base Register failed.
The architecture guarantees that any translation table entry that causes a Translation fault is not cached, meaning
the TLB never holds such an entry. Therefore, when a Translation fault occurs, the fault handler does not have to
perform any TLB maintenance operations to remove the faulting entry.
A data or unified cache maintenance operation by MVA can generate a Translation fault. Whether an instruction
cache invalidate by MVA operation can generate a Translation fault is IMPLEMENTATION DEFINED, because it is
IMPLEMENTATION DEFINED whether the operation requires an address translation. If the instruction cache invalidate
by MVA operation requires an address translation then the operation can generate a Translation fault, otherwise it
cannot generate a Translation fault.
B3-1400 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Whether branch predictor maintenance operations can generate Translation faults is IMPLEMENTATION DEFINED,
because it is IMPLEMENTATION DEFINED whether the operation requires an address translation. If the branch
predictor maintenance operation requires an address translation then the operation can generate a Translation fault,
otherwise it cannot generate a Translation fault.
• For the relevant stage of address translation, the processor is not performing hardware management of the
Access flag. Support for hardware management of the Access flag is OPTIONAL and deprecated, but
SCTLR.HA is set to 1 when hardware management is supported and enabled.
Note
Hardware management of the Access flag cannot be supported for either:
— Non-secure PL2 stage 1 address translation
— Non-secure PL1&0 stage 2 address translation.
• A translation table descriptor with the Access flag bit set to 0 is loaded.
The architecture guarantees that any translation table entry that causes an Access flag fault is not cached, meaning
the TLB never holds such an entry. Therefore, when an Access flag fault occurs, the fault handler does not have to
perform any TLB maintenance operations to remove the faulting entry.
Whether any cache maintenance operations by MVA can generate Access flag faults is IMPLEMENTATION DEFINED.
Whether branch predictor invalidate by MVA operations can generate Access flag faults is IMPLEMENTATION
DEFINED.
First level When a first-level descriptor fetch returns a valid Section first-level descriptor, the domain field of
that descriptor is checked against the DACR. A first-level Domain fault is generated if this check
fails.
Second level When a second-level descriptor fetch returns a valid second-level descriptor, the domain field of the
first-level descriptor that required the second-level fetch is checked against the DACR, and a
second-level Domain fault is generated if this check fails.
For more information, see Domains, Short-descriptor format only on page B3-1358.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1401
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
A TLB might hold a translation table entry that cause a Domain fault. Therefore, if the handling of a Domain fault
results in an update to the associated translation tables, the software that updates the translation tables must
invalidate the appropriate TLB entry, to prevent the stale information in the TLB being used on a subsequent
memory access. For more information, see the translation table entry update examples in TLB maintenance
operations and the memory order model on page B3-1379.
Any change to the DACR must be synchronized by a context synchronization operation. For more information see
Synchronization of changes to system control registers on page B3-1457.
Permission fault
A Permission fault can be generated at any level of lookup, and the reported fault code identifies the lookup level.
See Access permissions on page B3-1352 for information about conditions that cause a Permission fault.
Note
When using the Short-descriptor translation table format, the translation table descriptors are checked for
Permission faults only for accesses to memory regions in Client domains.
A TLB might hold a translation table entry that cause a Permission fault. Therefore, if the handling of a Permission
fault results in an update to the associated translation tables, the software that updates the translation tables must
invalidate the appropriate TLB entry, to prevent the stale information in the TLB being used on a subsequent
memory access. For more information, see the translation table entry update examples in TLB maintenance
operations and the memory order model on page B3-1379.
Note
In an implementation that includes the Virtualization Extensions, this maintenance requirement applies to
Permission faults in both stage 1 and stage 2 translations.
Cache or branch predictor maintenance operations cannot cause a Permission fault, except that:
• a stage 1 translation table walk performed as part of a cache or branch predictor maintenance operation can
generate a stage 2 Permission fault as described in Stage 2 fault on a stage 1 translation table walk,
Virtualization Extensions on page B3-1399.
• a DCIMVAC issued in Non-secure state that attempts to update date in a location for which it does not have
stage 2 write access can generate a stage 2 Permission fault, as described in Virtualization Extensions
upgrading of maintenance operations on page B2-1284.
For more information, see Terminology for describing exceptions on page B1-1136.
The ARM architecture does not provide any method to distinguish between precise asynchronous and imprecise
asynchronous aborts.
The ARM architecture handles asynchronous aborts in a similar way to interrupts, except that they are reported to
the processor using the Data Abort exception. Setting the CPSR.A bit to 1 masks asynchronous aborts, see Program
Status Registers (PSRs) on page B1-1147.
Normally, external aborts are rare. An imprecise asynchronous external abort is likely to be fatal to the process that
is running. An example of an event that might cause an external abort is an uncorrectable parity or ECC failure on
a Level 2 Memory structure.
B3-1402 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
VMSAv7 permits external aborts on data accesses, translation table walks, and instruction fetches to be either
synchronous or asynchronous. The reported fault code identifies whether the external abort is synchronous or
asynchronous.
Note
Because imprecise asynchronous external aborts are normally fatal to the process that caused them, ARM
recommends that implementations make external aborts precise wherever possible.
The following subsections give more information about possible external aborts:
• External abort on instruction fetch
• External abort on data read or write
• External abort on a translation table walk
• Behavior of external aborts on a translation table walk caused by address translation
• Provision for classification of external aborts on page B3-1404
• Parity error reporting on page B3-1404.
The section Exception reporting in a VMSA implementation on page B3-1406 describes the reporting of external
aborts.
An implementation can report the external abort asynchronously from the instruction that it applies to. In such an
implementation these aborts behave essentially as interrupts. The aborts are masked when CPSR.A is set to 1,
otherwise they are reported using the Data Abort exception.
An implementation can report the external abort asynchronously from the instruction that generated the access. In
such an implementation these aborts behave essentially as interrupts. The aborts are masked when CPSR.A is set
to 1, otherwise they are reported using the Data Abort exception.
If an implementation reports the error in the translation table walk asynchronously from executing the instruction
whose instruction fetch or memory access caused the translation table walk, these aborts behave essentially as
interrupts. The aborts are masked when CPSR.A is set to 1, otherwise they are reported using the Data Abort
exception.
The address translation operations summarized in Address translation operations, functional group on
page B3-1493 require translation table walks. An external abort can occur in the translation table walk. The abort
generates a Data Abort exception, and can be synchronous or asynchronous. For more information, see Handling of
faults and aborts during an address translation operation on page B3-1437.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1403
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
For all aborts other than external aborts these bits return a value of 0.
A fault code is defined for reporting parity errors, see Exception reporting in a VMSA implementation on
page B3-1406. However when parity error reporting is implemented it is IMPLEMENTATION DEFINED whether a
parity error is reported using the assigned fault code, or using another appropriate encoding.
For all purposes other than the fault status encoding, parity errors are treated as external aborts.
• If a memory access generates an Alignment fault because SCTLR.A is set to 1, or because it is an unaligned
access by an instruction that does not support unaligned accesses, then that access cannot generate any of:
— an MMU fault, on either the stage 1 translation or the stage 2 translation
— an external abort
— a Watchpoint debug event.
In an implementation that includes the Virtualization Extensions, an Alignment fault generated by an
unaligned access to Device or Strongly-ordered memory is prioritized as an MMU fault. For more
information see Alignment faults caused by accessing Device or Strongly-ordered memory on page B3-1405.
• If a memory access generates an MMU fault on its stage 1 translation, and also generates an abort on its stage
2 translation, the fault from the stage 1 translation has priority:
— if a memory access made as part of a stage 1 translation table walk generates an MMU fault on its stage
2 translation, as described in Stage 2 fault on a stage 1 translation table walk, Virtualization
Extensions on page B3-1399, the stage 1 translation table walk does not generate an MMU fault on the
stage 1 translation
— a fault on a particular stage of translation might be a synchronous external abort on a translation table
walk made at that stage of translation.
• If a memory access generates an MMU fault on either its stage 1 translation or on its stage 2 translation, then
the processor cannot generate a Watchpoint debug event on that access.
• If a memory access generates an MMU fault on either its stage 1 translation or on its stage 2 translation, or
generates a synchronous Watchpoint debug event, then the memory access cannot generate an external abort.
• Except as defined in this list, the architecture does not define any prioritization of asynchronous external
aborts relative to any other asynchronous aborts.
If a single instruction generates aborts on more than one memory access, the architecture does not define any
prioritization between those aborts.
In general, the ARM architecture does not define when asynchronous events are taken, and therefore the
prioritization of asynchronous events is IMPLEMENTATION DEFINED.
B3-1404 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.12 VMSA memory aborts
Note
Debug event prioritization on page C3-2064 describes:
• the relationship between debug events, MMU faults, and external aborts, for synchronous aborts generated
by the same memory access
The MMU fault checking sequence in Figure B3-24 on page B3-1398 shows this prioritization.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1405
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
About exception reporting introduces the general approach to exception reporting, and the following sections then
describe exception reporting at different privilege levels:
• Reporting exceptions taken to PL1 modes on page B3-1407.
• Fault reporting in PL1 modes on page B3-1410
• Summary of register updates on faults taken to PL1 modes on page B3-1414
• Reporting exceptions taken to the Non-secure PL2 mode on page B3-1417
• Use of the HSR on page B3-1421
• Summary of register updates on exceptions taken to the PL2 mode on page B3-1431.
Note
The registers used for exception reporting also report information about debug exceptions. For more information
see:
• Data Abort exceptions, taken to a PL1 mode on page B3-1407
• Prefetch Abort exceptions, taken to a PL1 mode on page B3-1410
• Reporting exceptions taken to the Non-secure PL2 mode on page B3-1417.
Otherwise, they are taken to a PL1 mode. Exception reporting in the PL2 mode differs significantly from that in the
PL1 modes, but in general, exception reporting returns
• for synchronous exceptions, one or more addresses associated with the exceptions, returned in Fault Address
Registers (FARs)
In both PLI modes and the PL2 mode, additional IMPLEMENTATION DEFINED registers can provide additional
information about exceptions.
Note
• Processor mode for taking exceptions on page B1-1172 describes how the mode to which an exception is
taken is determined.
B3-1406 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Memory system faults generate either a Data Abort exception or a Prefetch Abort exception, as summarized in:
• Reporting exceptions taken to PL1 modes
• Memory fault reporting at PL2 on page B3-1418.
On an access that might have multiple aborts, the MMU fault checking sequence and the prioritization of aborts
determine which abort occurs. For more information, see The MMU fault-checking sequence on page B3-1395 and
Prioritization of aborts on page B3-1404.
Fault reporting in PL1 modes on page B3-1410 then describes the fault reporting in these modes, including the
encodings used for reporting the faults.
Note
Before ARMv7, the Data Fault Address Register (DFAR) was called the Fault Address Register (FAR).
In addition, if implemented, the optional ADFSR and AIFSR can provide additional fault information, see Auxiliary
Fault Status Registers.
The ARMv7 architecture defines the following Auxiliary Fault Status Registers:
• the Auxiliary Data Fault Status Register, ADFSR
• the Auxiliary Instruction Fault Status Register, AIFSR.
The position of these registers is architecturally-defined, but the content and use of the registers is IMPLEMENTATION
DEFINED. An implementation can use these registers to return additional fault status information. An example use
of these registers is to return more information for diagnosing parity errors.
An implementation that does not need to report additional fault information must implement these registers as
UNK/SBZP. This ensures that an attempt to access these registers from software executing at PL1 does not cause
an Undefined Instruction exception.
For more information, see ADFSR and AIFSR, Auxiliary Data and Instruction Fault Status Registers, VMSA on
page B4-1519
• If the exception is on an instruction cache or branch predictor maintenance operation by MVA, its reporting
depends on the current translation table format. For more information about the registers used when reporting
the exception, see Data Abort on an instruction cache maintenance operation by MVA on page B3-1408.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1407
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
• If the exception is generated by a Watchpoint debug event, then its reporting depends on whether the
Watchpoint debug event is synchronous or asynchronous, and on the Debug architecture version. For more
information, see Data Abort on a Watchpoint debug event.
Otherwise:
• The DFSR is updated with details of the fault, including the appropriate fault status code.
If the Data Abort exception is synchronous, DFSR.WnR is updated to indicate whether the faulted access was
caused by a read instruction or a write instruction. However, if the fault is:
— On a cache maintenance operation, or on a CP15 address translation operation, WnR is set to 1, to
indicate a write access fault, and if the implementation includes the Large Physical Address Extension,
the CM bit is set to 1
— Generated by an SWP or SWPB instruction, WnR is set to 0 if a read of the location would have generated
a fault, otherwise it is set to 1.
DFSR.WnR is UNKNOWN on an asynchronous Data Abort exception.
See the register description for more information about the returned fault information.
If an instruction cache or branch predictor invalidation by MVA operation generates a Data Abort exception that is
taken to a PL1 mode, the DFAR is updated to hold the faulting VA. However, the reporting of the fault depends on
the current translation table format:
Short-descriptor format
It is IMPLEMENTATION DEFINED which of the following is used when reporting the fault:
• The DFSR indicates an Instruction cache maintenance operation fault, and the IFSR is valid
and indicates the cause of the fault, a Translation fault or Access flag fault.
• The DFSR indicates the cause of the fault, a Translation fault or Access flag fault. The IFSR
is UNKNOWN.
In either case:
• DFSR.WnR is set to 1
• if the implementation includes the Large Physical Address Extension, DFSR.CM is set to 1,
to indicate a fault on a cache maintenance operation.
Long-descriptor format
• DFSR.CM is set to 1, to indicates a fault on a cache maintenance operation
• DFSR.STATUS indicates the cause of the fault, a Translation or Access flag fault
• DFSR.WnR is set to 1
• the IFSR is UNKNOWN.
On taking a Data Abort exception caused by a Watchpoint debug event, DFSR is updated with the details of the
fault:
• if using the Short-descriptor format, DFSR.FS is updated to indicate a debug event and DFSR.Domain is
UNKNOWN.
B3-1408 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
• if the implementation includes the Large Physical Address Extension, DFSR.CM is updated to indicate
whether the Watchpoint was caused by a cache maintenance operation.
• DFSR.WnR is UNKNOWN.
The remaining register updates depend on the Debug architecture version, and in v7.1 debug, on whether the
Watchpoint debug event is synchronous or asynchronous:
Note
In particular, there is no guarantee of generating the watchpoint with the lowest address in the range.
Note
For a synchronous Watchpoint debug event:
• in v7 Debug, both LR_abt and DBGWFAR indicate the address of the instruction that triggered the
watchpoint, and ARM deprecates using DBGWFAR to determine the address of this instruction.
• in v7.1 Debug, only LR_abt indicates the address of the instruction that triggered the watchpoint
Synchronous Watchpoint debug event additional restriction on DFAR or HDFAR reporting, v7.1
Debug
In v7.1 Debug, when reporting a synchronous Watchpoint debug event triggered by a Load or Store instruction, it
is IMPLEMENTATION DEFINED whether there is an additional restriction on the lower value of the permitted range of
values that might be reported in the DFAR or HDFAR. ARM recommends that implementations define such a
restriction, and that the restriction requires that:
• For a Watchpoint debug event triggered by a Load or Store instruction, the lowest address that is reported in
the DFAR or HDFAR is both:
— no lower than the address of the watchpointed location rounded down to a multiple of an
IMPLEMENTATION DEFINED number of bytes
— no lower than the lowest address accessed by the instruction that triggered the watchpoint.
• The IMPLEMENTATION DEFINED number of bytes that defines this lowest address is a power of two, and less
than or equal to the cache line size specified in CCSIDR.LineSize.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1409
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
This additional restriction does not apply to any watchpoint generated by a cache maintenance instruction. For these
instructions, the lowest address accessed by the instruction can be less than the address passed to the operation,
because the operation acts on a whole cache line.
Note
A debugger can choose to ignore this restriction. However, a debugger can use this restriction to refine its
interpretation of the value returned in the DFAR or HDFAR.
There is no mechanism by which software can discover whether this restriction is implementation. The
documentation of any implementation that includes this restriction must include a full description of its
implementation of the restriction.
• If the processor attempts to execute the instruction a Prefetch Abort exception is generated.
• If an instruction fetch is issued but the processor does not attempt to execute the prefetched instruction, no
Prefetch Abort exception is generated for that instruction. For example, if the execution flow branches round
a prefetched instruction, no Prefetch Abort exception is generated.
In addition, debug exceptions caused by a BKPT instruction, Breakpoint, or a Vector catch debug event, generate a
Prefetch Abort exception, see Debug exception on BKPT instruction, Breakpoint, or Vector catch debug events on
page C4-2076.
• The IFSR is updated with details of the fault, including the appropriate fault code. If appropriate, the fault
code indicates that the exception was generated by a debug exception.
See the register description for more information about the returned fault information.
• For a Prefetch Abort exception generated by an instruction fetch, the IFAR is updated with the VA that caused
the exception.
• For a Prefetch Abort exception generated by a debug exception, the IFAR is UNKNOWN.
If the implementation includes the Security Extensions, the security state of the processor in the mode to which it
takes the Prefetch Abort exception determines whether the exception updates the Secure or Non-secure IFSR and
IFAR.
Therefore, the following subsections describe fault reporting in PL1 modes for each of the translation table formats:
• PL1 fault reporting with the Short-descriptor translation table format on page B3-1411
• Fault reporting with the Long-descriptor translation table format on page B3-1413.
Reserved encodings in the IFSR and DFSR encodings tables on page B3-1414 gives some additional information
about the encodings for both formats.
Summary of register updates on faults taken to PL1 modes on page B3-1414 shows which registers are updated on
each of the reported faults.
B3-1410 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Reporting of External aborts taken from Non-secure state to Monitor mode describes how the fault status register
format is determined for those aborts. For all other aborts, the current translation table format determines the format
of the fault status registers.
Note
Previous ARM documentation classified faults using the terms precise and imprecise instead of synchronous and
asynchronous. For details of the more exact terminology introduced in this manual see Terminology for describing
exceptions on page B1-1136.
Normally, the current translation table format determines the format of the DFSR and IFSR. However, when
SCR.EA is set to 1, to route external aborts to Monitor mode, and an external abort is taken from Non-secure state,
this section defines the DFSR and IFSR format.
For an External abort taken from Non-secure state to Monitor mode, the DFSR or IFSR uses the format associated
with the Long-descriptor translation table format, as described in Fault reporting with the Long-descriptor
translation table format on page B3-1413, if any of the following applies:
Otherwise, the DFSR or IFSR uses the format associated with the Short-descriptor translation table format, as
described in PL1 fault reporting with the Short-descriptor translation table format.
• the implementation does not include the Large Physical Address Extension
• the implementation includes the Large Physical Address Extension, and address translation is using the
Short-descriptor translation table format.
On taking an exception, bit[9] of the FSR is RAZ, or set to 0, if the processor is using this FSR format.
An FSR encodes the fault in a 5-bit FS field, that comprises FSR[10, 3:0]. Table B3-23 on page B3-1412 shows the
encoding of that field. Summary of register updates on faults taken to PL1 modes on page B3-1414 shows:
• Whether the corresponding FAR is updated on the fault. That is:
— for a fault reported in the IFSR, whether the IFAR holds a valid address
— for a fault reported in the DFSR, whether the DFAR holds a valid address
• For faults that update DFSR, whether DFSR.Domain is valid
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1411
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
FS Source Notes
10000 TLB conflict abort See TLB conflict aborts on page B3-1376
The DFSR includes a Domain field. This is inherited from previous versions of the VMSA. The IFSR does not
include a Domain field. Summary of register updates on faults taken to PL1 modes on page B3-1414 describes when
DFSR.Domain is valid.
ARM deprecates any use of the Domain field in the DFSR. The Long-descriptor translation table format does not
support a Domain field, and future versions of the ARM architecture might not support a Domain field in the
Short-descriptor translation table format. ARM strongly recommends that new software does not use this field.
For both Data Abort exceptions and Prefetch Abort exceptions, software can find the domain information by
performing a translation table read for the faulting address and extracting the Domain field from the translation table
entry.
B3-1412 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
When the processor takes an exception, bit[9] of the FSR is set to 1 if the processor is using this FSR format.
The FSRs encode the fault in a 6-bit STATUS field, that comprises FSR[5:0]. Table B3-24 shows the encoding of
that field. In addition:
• For a fault taken to a PL1 mode, Summary of register updates on faults taken to PL1 modes on page B3-1414
shows whether the corresponding FAR is updated on the fault. That is:
— for a fault reported in the IFSR, whether the IFAR holds a valid address
— for a fault reported in the DFSR, whether the DFAR holds a valid address
• For a fault taken to the PL2 mode, Summary of register updates on exceptions taken to the PL2 mode on
page B3-1431 shows what registers are updated on the fault
110000 TLB conflict abort. See TLB conflict aborts on page B3-1376
1111LL Domain fault. MMU fault. 64-bit PAR only, First or second
LL bits indicate level b. level only. Never used in DFSR, IFSR, or HSR d
a. STATUS values not shown in this table are reserved. STATUS values not supported in the IFSR or DFSR are reserved for the register or
registers in which they are not supported.
b. See The level associated with MMU faults on page B3-1414.
c. Including Virtual Abort.
d. A Domain fault can be reported using the Long-descriptor STATUS encodings only as a result of a fault on an address translation operation.
For more information see MMU fault on an address translation operation on page B3-1438.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1413
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
For MMU faults, Table B3-25 shows how the LL bits in the xFSR.STATUS field encode the lookup level associated
with the fault.
Table B3-25 Use of LL bits to encode the lookup level at which the fault occurred
LL bits Meaning
00 Reserved.
01 First level.
10 Second level.
11 Third level. When xFSR.STATUS indicates a Domain fault, this value is reserved.
• For a fault generated on a translation table walk, the lookup level of the walk being performed.
• For a Translation fault, the lookup level of the translation table that gave the fault. If a fault occurs because
an MMU is disabled, or because the input address is outside the range specified by the appropriate base
address register or registers, the fault is reported as a First level fault.
• For an Access flag fault, the lookup level of the translation table that gave the fault.
• For a Permission fault, including a Permission fault caused by hierarchical permissions, the lookup level of
the final level of translation table accessed for the translation. That is, the lookup level of the translation table
that returned a Block or Page descriptor.
• Cache and TLB lockdown faults. The details of these faults and any associated subsidiary registers are
IMPLEMENTATION DEFINED.
• Aborts associated with coprocessors. The details of these faults are IMPLEMENTATION DEFINED.
For faults that update the DFSR using the Short-descriptor format FSR encodings, Table B3-27 on page B3-1416
shows whether DFSR.Domain is valid.
B3-1414 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Table B3-26 Effect of a fault taken to a PL1 mode on the reporting registers
Fault on instruction cache maintenance, when using Long-descriptor UNK - Yes Yes -
translation table format a.
Fault on instruction cache maintenance, when using either Yes - Yes Yes -
Short descriptor translation table format b.
or UNK - Yes Yes -
Debug exceptions:
a. When using the Long-descriptor translation table format, there is not a specific fault code for a fault on an instruction cache maintenance
operation. For more information see Data Abort on an instruction cache maintenance operation by MVA on page B3-1408.
b. The two lines of this entry show the alternative ways of reporting the fault when using the Short-descriptor translation table format. It is
IMPLEMENTATION DEFINED which methods is used, see Data Abort on an instruction cache maintenance operation by MVA on
page B3-1408.
c. Including Virtual Abort.
d. Generates a Prefetch Abort exception.
e. Generates a Data Abort exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1415
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
For those faults for which Table B3-26 on page B3-1415 shows that the DFSR is updated, if the fault is reported
using the Short-descriptor FSR encodings, Table B3-27 shows whether DFSR.Domain is valid. In this table, UNK
indicates that the fault makes DFSR.Domain UNKNOWN.
Table B3-27 Validity of Domain field on faults that update the DFSR using the Short-descriptor encodings
a. Previously, this encoding was a deprecated encoding for Alignment fault. The extensive changes in the memory model in
VMSAv7 mean there should be no possibility of confusing the new use of this encoding with its previous use
b. Including asynchronous data external abort on translation table walk or instruction fetch.
c. Including asynchronous parity error on translation table walk.
Note
As Table B3-27 shows, if an implementation includes the Large Physical Address Extension, and address translation
is using the Short-descriptor translation table format, on a Permission fault that causes a Data Abort exception, the
DFSR.Domain field is UNKNOWN. This is a change from the architecturally-required behavior on an implementation
that does not include the Large Physical Address Extension.
B3-1416 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Note
Software executing in Monitor mode can perform an exception return to Hyp mode. This means Hyp mode is
entered either by taking an exception, or by a permitted exception return.
• Asynchronous external aborts, IRQ exceptions, and FIQ exceptions, from Non-secure PL0 and PL1 modes,
if not routed to Secure Monitor mode, can each be routed to Hyp mode. For more information see
Asynchronous exception routing controls on page B1-1174.
• If HCR.TGE is set to 1, the following exceptions. if taken from the Non-secure PL0 mode, are routed to Hyp
mode:
— Undefined Instruction exceptions
— Supervisor Call exception
— synchronous external aborts
— Alignment faults.
For more information, see Routing general exceptions to Hyp mode on page B1-1190.
• If HCR.TDE is set to 1, any Debug exception take from a Non-secure PL1 or PL0 mode, is routed to Hyp
mode. For more information, see Routing Debug exceptions to Hyp mode on page B1-1193.
• The privilege rules for taking exceptions mean that any exception taken from Hyp mode, if not routed to
Secure Monitor mode, must be taken to Hyp mode. See Exceptions, privilege, and security state on
page B1-1137. This includes a Prefetch Abort exception generated by a Debug exception on a BKPT
instruction.
Note
Debug exceptions other than the exception on a BKPT instruction are not permitted in Hyp mode.
• Hypervisor Call exceptions, and Hyp Trap exceptions, are always taken to Hyp mode. These exceptions are
supported only as part of the Virtualization Extensions.
In an implementation that includes the Virtualization Extensions, various operations from Non-secure PL0
and PL1 modes can be trapped to Hyp mode, using the Hyp Trap exception. For more information, see Traps
to the hypervisor on page B1-1246.
Memory fault reporting at PL2 on page B3-1418 gives more information about these faults.
The following exceptions provide syndrome information syndrome information in the HSR:
• Some exceptions taken from Debug state that would be taken to Hyp mode if the processor was not in Debug
state, see Exceptions in Debug state on page C5-2093.
Note
— In Debug state, the processor does not change mode on taking an exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1417
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
— As Exceptions in Debug state on page C5-2093 describes, some other exceptions taken from Debug
state make the HSR UNKNOWN.
The syndrome information in the HSR includes the fault status code otherwise provided by the fault status register,
and greatly extends the fault reporting. For more information, see Use of the HSR on page B3-1421.
In addition, for a Debug exception taken to Hyp mode, DBGDSCR.MOE shows what caused the Debug exception.
This bit is valid regardless of whether the Debug exception was taken from Hyp mode or from another Non-secure
mode.
Registers used for reporting exceptions taken to Hyp mode lists all of the registers used for exception reporting at
PL2.
In addition, if implemented, the optional HADFSR and HAIFSR can provide additional fault information, see Hyp
Auxiliary Fault Syndrome Registers.
The Virtualization Extensions define the following Hyp Auxiliary Fault Syndrome Registers:
• the Hyp Auxiliary Data Fault Syndrome Register, HADFSR
• the Hyp Auxiliary Instruction Fault Syndrome Register, HAIFSR.
An implementation can use these registers to return additional fault status information for aborts taken to Hyp mode.
They are the Hyp mode equivalents of the registers described in Auxiliary Fault Status Registers on page B3-1407.
An example use of these registers is to return more information for diagnosing parity errors.
• The position of these registers is architecturally-defined, but the content and use of the registers is
IMPLEMENTATION DEFINED.
• An implementation with no requirement for additional fault reporting can implement these registers as
UNK/SBZP, but the architecture does not require it to do so.
For more information, see HADFSR and HAIFSR, Hyp Auxiliary Fault Syndrome Registers, Virtualization
Extensions on page B4-1572.
• The HSR.EC field indicates the type of abort, as Table B3-28 on page B3-1419 shows.
• The HSR.ISS field holds more information about the abort. In particular:
— bits[5:0] of this field hold the STATUS field for the abort, using the encodings defined in Fault
reporting with the Long-descriptor translation table format on page B3-1413
— other subfields of the ISS give more information about the exception, equivalent to the information
returned in the FSR for a memory fault reported at PL1.
See the descriptions of the ISS fields for the memory faults, referenced from the Syndrome description
column of Table B3-28 on page B3-1419, for information about the returned fault information.
B3-1418 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
0x20 Prefetch Abort taken from Non-secure PL0 or PL1 mode ISS encoding for Prefetch Abort exceptions taken to Hyp
mode on page B3-1428
0x21 Prefetch Abort taken from Hyp mode
0x24 Data Abort taken from Non-secure PL0 or PL1 mode ISS encoding for Data Abort exceptions taken to Hyp mode
on page B3-1429
0x25 Data Abort taken from Hyp mode
A Prefetch Abort exception is taken synchronously with the instruction that the abort is reported on. This means:
• If the processor attempts to execute the instruction a Prefetch Abort exception is generated.
• If an instruction fetch is issued but the processor does not attempt to execute the prefetched instruction, no
Prefetch Abort exception is generated for that instruction. For example, if the execution flow branches round
a prefetched instruction, no Prefetch Abort exception is generated.
The use of the HSR, and of the other registers listed in Registers used for reporting exceptions taken to Hyp mode
on page B3-1418, depends on the cause of the Abort. In reporting these faults, in general:
• If the fault generates a synchronous Data Abort exception, the HDFAR holds the associated VA.
• If the fault generates a Prefetch Abort exception, the HIFAR holds the associated VA.
• In the following cases, the HPFAR holds the faulting IPA:
— a Translation or Access flag fault on a stage 2 translation
— a fault on the stage 2 translation of an address accessed in a stage 1 translation table walk.
In all other cases, the HPFAR is UNKNOWN.
• On a Data Abort exception that is taken to Hyp mode, the HIFAR is UNKNOWN.
• On a Prefetch Abort exception that is taken to Hyp mode, the HDFAR is UNKNOWN.
In addition, the reporting of particular aborts is as follows:
Abort on the stage 1 translation for a memory access from Hyp mode
The HDFAR or HIFAR holds the VA that caused the fault. The STATUS subfield of HSR.ISS
indicates the type of fault, Translation, Access flag, or Permission. The HPFAR is UNKNOWN.
Abort on the stage 2 translation for a memory access from a Non-secure PL1 or PL0 mode
This includes aborts on the stage 2 translation of a memory access made as part of a translation table
walk for a stage 1 translation. The HDFAR or HIFAR holds the VA that caused the fault. The
STATUS subfield of HSR.ISS indicates the type of fault, Translation, Access flag, or Permission.
For any Access flag fault or Translation fault, and also for any Permission fault on the stage 2
translation of a memory access made as part of a translation table walk for a stage 1 translation, the
HPFAR holds the IPA that caused the fault. Otherwise, the HPFAR is UNKNOWN.
Abort caused by a synchronous external abort, or synchronous parity error, and taken to Hyp mode
The HDFAR or HIFAR holds the VA that caused the fault. The HPFAR is UNKNOWN.
Abort caused by a Watchpoint debug event and routed to Hyp mode because HDCR.TDE is set to 1
When HDCR.TDE is set to 1, a debug exception on a Watchpoint debug event, generated in a
Non-secure PL1 or PL0 mode, that would otherwise generate a Data Abort exception, is routed to
Hyp mode and generates a Hyp Trap exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1419
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
The reporting of the exception depends on whether the Watchpoint debug event is synchronous or
asynchronous:
Synchronous Watchpoint debug event
HDFAR is set to the address that generated the watchpoint, and DBGWFAR is
UNKNOWN.
A watchpointed address can be any byte-aligned address. The address reported in
HDFAR might not be the watchpointed address, and can be any address between and
including:
• the lowest address accessed by the instruction that triggered the watchpoint
• the highest watchpointed address accessed by that instruction.
If multiple watchpoints are set in this range, there is no guarantee of which watchpoint
is generated.
Note
In particular, there is no guarantee of generating the watchpoint with the lowest address
in the range.
Prefetch Abort caused by a Debug exception on a BKPT instruction debug event and taken to Hyp mode
This abort is generated if a BKPT instruction is executed in Hyp mode. The abort leaves the HIFAR
and HPFAR UNKNOWN.
See also Debug exception on BKPT instruction, Breakpoint, or Vector catch debug events on
page C4-2076.
Abort caused by a BKPT instruction, Breakpoint, or Vector catch debug event, and routed to Hyp mode
because HDCR.TDE is set to 1
When HDCR.TDE is set to 1, a debug exception, generated in a Non-secure PL1 or PL0 mode, that
would otherwise generate a Prefetch Abort exception, is routed to Hyp mode and generates a Hyp
Trap exception.
The abort leaves the HIFAR and HPFAR UNKNOWN. This is identical to the reporting of a Prefetch
Abort exception caused by a Debug exception on a BKPT instruction that is executed in Hyp mode.
Note
The difference between these two cases is:
• the Debug exception on a BKPT instruction executed in Hyp mode generates a Prefetch Abort
exception, taken to Hyp mode, and reported in the HSR using EC value 0x21.
• aborts generated because HDCR.TDE is set to 1 generate a Hyp Trap exception, and are
reported in the HSR using EC value 0x20.
B3-1420 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Note
IRQ and FIQ exceptions taken to Hyp mode do not report any syndrome information in the HSR.
• A 6-bit exception class field, EC, that indicates the cause of the exception.
• An instruction length bit, IL. When an exception is caused by trapping an instruction to Hyp mode, this bit
indicates the length of the trapped instruction, as follows:
0 16-bit instruction trapped.
1 32-bit instruction trapped.
This field is not valid for the following cases:
— When the EC field is 0x00, indicating an exception with an unknown reason.
— Prefetch Aborts.
— Data Aborts that do not have ISS information, or for which the ISS is not valid.
In these cases, the IL field is UNK/SBZP.
• An instruction specific syndrome field, ISS. Architecturally, this field can be defined independently for each
defined exception class.
This field is not valid, UNK/SBZP, when the EC field is 0x00, indicating an exception with an unknown
reason.
Figure B3-25 shows the format of the HSR, with the subdivision of the ISS field that applies to nonzero EC values
with the two most significant bits 0b00.
31 30 29 26 25 24 23 20 19 0
xx not 00, or EC zero x x
EC nonzero 0 0 COND
CV
EC IL ISS
Figure B3-25 Format of the HSR, with subdivision of the ISS field for specified EC encodings
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1421
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
0x01 Trapped WFI or WFE instruction ISS encoding for trapped WFI or WFE instruction on page B3-1423.
0x03 Trapped MCR or MRC access to CP15 ISS encoding for trapped MCR or MRC access on page B3-1424.
0x04 Trapped MCRR or MRRC access to CP15 ISS encoding for trapped MCRR or MRRC access on page B3-1424.
0x05 Trapped MCR or MRC access to CP14 ISS encoding for trapped MCR or MRC access on page B3-1424.
0x06 Trapped LDC or STC access to CP14 ISS encoding for trapped LDC or STC access on page B3-1425.
0x07 HCPTR-trapped access to CP0-CP13 ISS encoding for HCPTR-trapped access to CP0-CP13 on page B3-1426.
Includes trap on use of Advanced SIMD.
0x08 Trapped MRC or VMRS access to CP10, ISS encoding for trapped MCR or MRC access on page B3-1424.
for ID group traps This trap is not taken if the HCPTR settings trap the access.
0x0A Trapped BXJ instruction ISS encoding for trapped BXJ execution on page B3-1427.
0x0C Trapped MRRC access to CP14 ISS encoding for trapped MCRR or MRRC access on page B3-1424.
0x11 Supervisor Call exception routed to ISS encoding for Hypervisor Call exception, or Supervisor Call exception
Hyp mode routed to Hyp mode on page B3-1427.
0x13 Trapped SMC instruction ISS encoding for trapped SMC execution on page B3-1428.
0x20 Prefetch Abort routed to Hyp mode ISS encoding for Prefetch Abort exceptions taken to Hyp mode on
page B3-1428.
0x21 Prefetch Abort taken from Hyp mode
0x24 Data Abort routed to Hyp mode ISS encoding for Data Abort exceptions taken to Hyp mode on
page B3-1429.
0x25 Data Abort taken from Hyp mode
a. For more information see Encoding of ISS[24:20] when HSR[31:30] is 0b00 on page B3-1423.
All EC encodings not shown in Table B3-28 on page B3-1419 are reserved by ARM.
Undefined Instruction exception, when HCR.TGE is set to 1 on page B1-1191 describes the configuration settings
for a trap that returns an HSR.EC value of 0x00.
B3-1422 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
For EC values that are nonzero and have the two most-significant bits 0b00, ISS[24:20] provides the condition code
field for the trapped instruction, together with a valid flag for this field. The encoding of this part of the ISS field is:
CV, ISS[24] Condition code valid. Possible values of this bit are:
0 The COND field is not valid.
1 The COND field is valid
COND, ISS[23:20]
The condition code for the trapped instruction. This field is valid only when CV is set to 1.
If CV is set to 0, this field is UNK/SBZP.
When CV is set to 0, software must examine the SPSR.IT field to determine the conditionality of a Thumb
instruction.
Except for unconditional Thumb instructions reported with CV set to 0, a trapped unconditional instruction is
reported with CV set to 1 and a COND value of 0x0E, the condition code value for unconditional.
For an implementation that, for both ARM and Thumb instructions, takes an exception on a trapped conditional
instruction only if the instruction passes its condition code check, these definitions mean that when CV is set to 1 it
is IMPLEMENTATION DEFINED whether the COND field is set to 0xE, or to the value of any condition that applied to
the instruction.
Note
In some circumstances, it is IMPLEMENTATION DEFINED whether a conditional instruction that fails its condition
code check generates an Undefined Instruction exception, see Conditional execution of undefined instructions on
page B1-1208.
This is the exception with EC value 0x01. When HSR.EC returns this value, the encoding of the ISS field is:
24 23 20 19 1 0
CV COND Reserved, UNK/SBZP
Trapped instruction
ISS[0] Indicates the trapped instruction. The possible values of this bit are:
0 WFI trapped.
1 WFE trapped.
Trapping use of the WFI and WFE instructions on page B1-1253 describes the configuration settings for this trap.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1423
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
When HSR.EC returns one of these values, the encoding of the ISS field is:
24 23 20 19 17 16 14 13 10 9 8 5 4 1 0
CV COND Opc2 Opc1 CRn (0) Rt CRm
Direction
ISS[24:20] See Encoding of ISS[24:20] when HSR[31:30] is 0b00 on page B3-1423.
ISS[19:17] The Opc2 value from the issued instruction.
For a trapped VMRS access, this field holds the value 0b000.
ISS[16:14] The Opc1 value from the issued instruction.
For a trapped VMRS access, this field holds the value 0b111.
ISS[13:10] The CRn value from the issued instruction, the coprocessor primary register value.
For a trapped VMRS access, this field holds the reg field from the VMRS instruction encoding.
ISS[9] Reserved, UNK/SBZP.
ISS[8:5] The Rt value from the issued instruction, the ARM core register used for the transfer.
ISS[4:1] The CRm value from the issued instruction.
For a trapped VMRS access, this field holds the value 0b0000.
ISS[0] Indicates the direction of the trapped instruction. The possible values of this bit are:
0 Write to coprocessor. MCR instruction.
1 Read from coprocessor. MRC or VMRS instruction.
The following sections describe configuration settings for traps that are reported using EC value 0x03:
• Trapping ID mechanisms on page B1-1249
• Trapping accesses to lockdown, DMA, and TCM operations on page B1-1251
• Trapping accesses to cache maintenance operations on page B1-1252
• Trapping accesses to TLB maintenance operations on page B1-1252
• Trapping accesses to the Auxiliary Control Register on page B1-1252
• Trapping accesses to the Performance Monitors Extension on page B1-1253
• Trapping CPACR accesses on page B1-1256
• Generic trapping of accesses to CP15 system control registers on page B1-1256.
The following sections describe configuration settings for traps that are reported using EC value 0x05:
• ID group 0, Primary device identification registers on page B1-1250
• Trapping accesses to Jazelle functionality on page B1-1254, for accesses to Jazelle registers
• Trapping accesses to the ThumbEE configuration registers on page B1-1254
• Trapping CP14 accesses to Debug ROM registers on page B1-1258
• Trapping CP14 accesses to OS-related debug registers on page B1-1258
• Trapping general CP14 accesses to debug registers on page B1-1258
• Trapping CP14 accesses to trace registers on page B1-1259.
Trapping ID mechanisms on page B1-1249 describes configuration settings for traps that are reported using EC
value 0x08.
B3-1424 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
When HSR.EC returns one of these values, the encoding of the ISS field is:
24 23 20 19 16 15 14 13 10 9 8 5 4 1 0
CV COND Opc1 (0) (0) Rt2 (0) Rt CRm
Direction
ISS[13:10] The Rt2 value from the issued instruction, one of the ARM core registers for the transfer.
ISS[8:5] The Rt value from the issued instruction, one of the ARM core registers for the transfer.
ISS[4:1] The CRm value from the issued instruction, the coprocessor primary register value.
ISS[0] Indicates the direction of the trapped instruction. The possible values of this bit are:
0 Write to coprocessor. MCRR instruction.
1 Read from coprocessor, MRRC instruction.
The following sections describe configuration settings for traps that are reported using EC value 0x04:
• Trapping writes to virtual memory control registers on page B1-1256
• Generic trapping of accesses to CP15 system control registers on page B1-1256.
The following sections describe configuration settings for traps that are reported using EC value 0x0C:
• Trapping general CP14 accesses to debug registers on page B1-1258
• Trapping CP14 accesses to Debug ROM registers on page B1-1258.
Addressing mode
Direction
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1425
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
ISS[0] Indicates the direction of the trapped instruction. The possible values of this bit are:
0 Write to memory. STC instruction.
1 Read from memory. LDC instruction.
Note
The only architected uses of these instructions to access CP14 are:
• an STC to write to DBGDTRRXint
• an LDC to read DBGDTRTXint.
For more information see CP14 debug register interface accesses on page C6-2110.
Trapping general CP14 accesses to debug registers on page B1-1258 describes the configuration settings for the
trap that is reported using EC value 0x06.
This is the exception with EC value 0x07. When HSR.EC returns this value, the encoding of the ISS field is:
24 23 20 19 6 5 4 3 0
CV COND Reserved, UNK/SBZP (0) coproc
ISS[5] Indicates trapped use of the Advanced SIMD Extension for instructions that are not also VFP
instructions. The possible values of this bit are:
0 Exception was not caused by trapped use of the Advanced SIMD Extension.
1 Exception was caused by trapped use of the Advanced SIMD Extension.
Any use of an Advanced SIMD instruction that is not also a floating point instruction that is trapped
to Hyp mode because of any traps configured in the HCPTR causes this bit to be set to 1.
ISS[3:0] coproc. The number of the coprocessor accessed by the trapped operation, 0-13.
This field is valid only when ISS[5] returns 0. Otherwise, it is UNK/SBZP.
B3-1426 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
The following sections describe the configuration settings for the traps that are reported using EC value 0x07:
• Trapping of Advanced SIMD functionality on page B1-1255
• General trapping of coprocessor accesses on page B1-1256
Trapping accesses to Jazelle functionality on page B1-1254 describes the configuration settings for this trap.
ISS encoding for Hypervisor Call exception, or Supervisor Call exception routed to Hyp mode
Note
• A Supervisor Call exception is generated by executing an SVC instruction, see SVC (previously SWI) on
page A8-721.
• A Hypervisor Call exception is generated by executing an HVC instruction, see HVC on page B9-1970.
When HSR.EC returns one of these values, the encoding of the ISS field is:
24 16 15 0
Reserved, UNK/SBZP imm16
ISS[15:0] imm16. The value of the immediate field from the issued instruction.
For an SVC instruction:
• If the instruction is unconditional:
— For the 16-bit Thumb instruction, this field is zero-extended from the imm8 field of
the instruction.
— For the ARM instruction, this field is the bottom 16 bits of the imm24 field of the
instruction.
• If the instruction is conditional, this field is UNKNOWN.
Note
The HVC instruction is unconditional, and a conditional SVC instruction generates a Supervisor Call exception that is
routed to Hyp mode only if it passes its condition code check. Therefore, the syndrome information for these
exceptions does not include conditionality information.
Supervisor Call exception, when HCR.TGE is set to 1 on page B1-1191 describes the configuration settings for the
trap reported with EC value 0x11.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1427
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
This is the exception with EC value 0x13. When HSR.EC returns this value, the ISS field does not return any
syndrome information, and the encoding of the ISS field is:
Note
SMC instructions cannot be trapped if they fail their condition code check. Therefore, the syndrome information for
this exception does not include conditionality information.
Trapping use of the SMC instruction on page B1-1253 describes the configuration settings for this trap, for
instructions executed in Non-secure PL1 modes.
When HSR.EC returns one of these values, the encoding of the ISS field is:
24 10 9 8 7 6 5 0
Reserved, UNK/SBZP (0) (0) IFSC
EA
S1PTW
ISS[9] EA, External abort type. Can provide an IMPLEMENTATION DEFINED classification of external
aborts. If the implementation does not provide any classification of external aborts, this bit is
UNK/SBZP.
For any abort other than an External abort this bit returns a value of 0.
Note
This bit is equivalent to the IFSR.ExT bit.
ISS[7] S1PTW. For a stage 2 fault, indicates whether the fault was a fault on the stage 2 translation of an
address accessed during a stage 1 translation table walk:
0 Fault not on a stage 2 translation for a stage 1 translation table walk.
1 Fault on the stage 2 translation of an access for a stage 1 translation table walk.
For a stage 1 fault, this bit is UNK/SBZP.
ISS[5:0] IFSC, Instruction fault status code. Indicates the fault that caused the exception, using the fault
codes defined for use with the Long-descriptor translation table format, see Fault reporting with the
Long-descriptor translation table format on page B3-1413.
Note
This field is equivalent to the IFSR.STATUS field, and only valid IFSR.STATUS values are valid
for this field.
The following sections describe cases where Prefetch Abort exceptions can be routed to Hyp mode, generating
exceptions that are reported in the HSR with EC value 0x20:
• Synchronous external abort, when HCR.TGE is set to 1 on page B1-1192.
B3-1428 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
When HSR.EC returns one of these values, the encoding of the ISS field is:
24 23 22 21 20 19 18 17 16 15 10 9 8 7 6 5 0
0 Reserved, UNK/SBZP Reserved,
DFSC
1 SAS (0) SRT UNK/SBZP
ISV EA
SSE CM
S1PTW
Instruction syndrome WnR
ISS[24] Instruction syndrome valid. Indicates whether ISS[24:16] provide a valid instruction syndrome, as
part of the returned ISS. The possible values of this bit are:
0 No valid instruction syndrome. ISS[23:16] are UNK/SBZP.
1 ISS[24:16] hold a valid instruction syndrome.
This bit is 0 for all faults except for those generated by a stage 2 translation. For Data Abort
exceptions generated by a stage 2 translation, this bit is 1 and a valid instruction syndrome is
returned only if all of the following are true:
• The instruction that generated the Data Abort exception:
— Is an LDR, LDRT, LDRSH, LDRSHT, LDRH, LDRHT, LDRSB, LDRSBT, LDRB, LDRBT, STR, STRT, STRH,
STRHT, STRB, or STRBT.
— Is not performing register writeback.
— Is not using the PC as its destination register.
A stage 2 abort on a stage 1 translation table lookup sets ISV[24] to 0.
Note
• In the ARM instruction set, LDR*T and STR*T instructions always perform register writeback
and therefore never return a valid instruction syndrome.
• A valid instruction syndrome provides information that can help a hypervisor to emulate the
instruction efficiently. Instruction syndromes are returned for instructions for which such
accelerated emulation is possible.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1429
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
ISS[9] EA, External abort type. Can provide an IMPLEMENTATION DEFINED classification of external
aborts. If the implementation does not provide any classification of external aborts, this bit is
UNK/SBZP.
For any abort other than an External abort this bit returns a value of 0.
Note
This bit is equivalent to the DFSR.ExT bit.
ISS[8] CM, Cache maintenance. For a synchronous fault, identifies fault that comes from a cache
maintenance or address translation operation. For synchronous faults, the possible values of this bit
are:
0 Fault not generated by a cache maintenance or address translation operation.
1 Fault generated by a cache maintenance or address translation operation.
For asynchronous faults, this bit is 0.
Note
This bit is equivalent to the DFSR.CM bit.
ISS[7] S1PTW. For a stage 2 fault, indicates whether the fault was a fault on the stage 2 translation of an
address accessed during a stage 1 translation table walk:
0 Fault not on a stage 2 translation for a stage 1 translation table walk.
1 Fault on the stage 2 translation of an access for a stage 1 translation table walk.
For a stage 1 fault, this bit is UNK/SBZP.
ISS[6] WnR. Indicates whether a synchronous abort was caused by a write instruction or by a read
instruction. The possible values of this bit are:
0 Abort caused by a read instruction.
1 Abort caused by a write instruction.
For synchronous faults on cache maintenance and address translation operations, this bit always
returns a value of 1.
Note
ISS[8] is set to 1 to identify a fault on a cache maintenance or address translation operation.
B3-1430 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Note
This bit is equivalent to the DFSR.WnR bit.
ISS[5:0] DFSC, Data fault status code. Indicates the fault that caused the exception, using the fault codes
defined for use with the Long-descriptor translation table format, see Fault reporting with the
Long-descriptor translation table format on page B3-1413.
Note
This field is equivalent to the DFSR.STATUS field, and all valid DFSR.STATUS values are valid
for this field.
The following describe cases where Data Abort exceptions can be routed to Hyp mode, generating exceptions that
are reported in the HSR with EC value 0x24:
• Alignment fault, when HCR.TGE is set to 1 on page B1-1192.
• Synchronous external abort, when HCR.TGE is set to 1 on page B1-1192.
• Routing Debug exceptions to Hyp mode on page B1-1193.
Table B3-30 Effect of an exception taken to the PL2 mode on the reporting registers
MMU Translation or Access flag fault a at stage 2. Yes Yes UNK Yes -
Synchronous external abort on translation table walk. Yes Yes UNK UNK -
Synchronous parity error on translation table walk. Yes Yes UNK UNK -
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1431
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Table B3-30 Effect of an exception taken to the PL2 mode on the reporting registers (continued)
MMU Translation or Access flag fault a at stage 2. Yes UNK Yes Yes -
Synchronous external abort on translation table walk. Yes UNK Yes UNK -
Synchronous parity error on translation table walk. Yes UNK Yes UNK -
Debug exception:
BKPT instruction debug event b, generates a Prefetch Abort exception. Yes UNK UNK UNK -
Debug exception routed to Hyp mode because HDCR.TDE is set to 1. Generates a Hyp Trap exception.
Breakpoint, BKPT instruction, or Vector catch debug event Yes UNK UNK UNK -
a. For more information see Classification of MMU faults taken to the PL2 mode on page B3-1433.
b. All other debug exceptions are not permitted in Hyp mode.
Note
Unlike Table B3-26 on page B3-1415, the PL2 fault reporting table does not include an entry for a fault on an
instruction cache maintenance operation. That is because, when the fault is taken to the PL2 mode, the reporting
indicates the cause of the fault, for example a Translation fault, and ISS.CM is set to 1 to indicate that the fault was
on a cache maintenance operation, see ISS encoding for Data Abort exceptions taken to Hyp mode on page B3-1429.
B3-1432 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.13 Exception reporting in a VMSA implementation
Note
All MMU faults are synchronous.
The table uses the following descriptions for MMU faults taken to the PL2 mode:
MMU fault at stage 1 This is an MMU fault generated on a stage 1 translation performed in the Non-secure PL2
translation regime.
MMU fault at stage 2 This is an MMU fault generated on a stage 2 translation performed in the Non-secure
PL1&0 translation regime.
As the table shows, for the faults in this group:
• Translation and Access flag faults update the HPFAR
• Permission faults leave the HPFAR UNKNOWN.
Figure B3-1 on page B3-1307 shows the different translation regimes and associated stages of translation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1433
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.14 Virtual Address to Physical Address translation operations
When using the Short-descriptor translation table format, all VA to PA translations take account of TEX remap when
this is enabled, see Short-descriptor format memory region attributes, with TEX remap on page B3-1364.
Note
A processor that does not implement the Large Physical Address Extension always uses the Short-descriptor
translation table format.
A VA to PA translation operation returns the PA in the PAR. The Large Physical Address Extension extends the PAR
to 64 bits, to hold PAs of up to 40 bits.
ATS1CPR, ATS1CPW, V2PCWPR, V2PCWPW, See Address translation stage 1, current security state on
ATS1CUR, ATS1CUW V2PCWUR, V2PCWUW page B3-1435
ATS12NSOPR, ATS12NSOPW, V2POWPR, V2POWPW, See Address translation stages 1 and 2, Non-secure state only on
ATS12NSOUR, ATS12NSOUW V2POWUR, V2POWUW page B3-1435
ATS1HR, ATS1HW Not applicable a See Address translation stage 1, Hyp mode on page B3-1436
a. Operations are part of the Virtualization Extensions and have no equivalent in the older descriptions.
In the stage 1 current state and stages 1 and 2 Non-secure state only operations, the meanings of the last two letters
of the names are:
PR PL1 mode, read operation.
PW PL1 mode, write operation.
UR PL0 mode, read operation.
UW PL0 mode, write operation.
Note
PL0 modes can also be described as unprivileged modes. User mode is the only PL0 mode.
B3-1434 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.14 Virtual Address to Physical Address translation operations
In the stage 1 Hyp mode operations, the last letter of the operation name is R for the read operation and W for the
write operation.
The following sections describe the use and availability of these operations:
• Address translation stage 1, current security state
• Address translation stages 1 and 2, Non-secure state only
• Address translation stage 1, Hyp mode on page B3-1436.
Encoding and availability of the address translation operations on page B3-1436 gives the encodings of the
operations.
These instructions perform the address translations of the PL1&0 translation regime of the current security state. In
an implementation that includes the Virtualization Extensions, when executed in Non-secure state, they return the
IPA that is the output address of the stage 1 translation. Figure B3-1 on page B3-1307 shows the different translation
regimes.
Note
The Non-secure PL1 and PL0 modes have no visibility of the stage 2 address translations, that can be defined only
at PL2, and translate IPAs to be PAs.
For an implementation that includes the Large Physical Address Extension, see Determining the PAR format, Large
Physical Address Extension on page B3-1437 for the format used when returning the result of these operations.
• If the implementation includes the Virtualization Extensions, by software executing in Non-secure state at
PL2. This means by software executing in Hyp mode.
ARM deprecates use of these operations from any Secure PL1 mode other than Monitor mode.
In Secure state, and in Non-secure Hyp mode on an implementation that includes the Virtualization Extensions,
these operations perform the translations made by the Non-secure PL1&0 translation regime.
These operations always return the PA and final attributes generated by the translation.That is, for an
implementation that includes the Virtualization Extensions, they return:
• the result of the two stages of address translation for the specified Non-secure input address.
• the memory attributes obtained by the combination of the stage 1 and stage 2 attributes.
Note
From Hyp mode, the ATS1Cxx and ATS12NSOxx operations both return the results of address translations that
would be performed in the Non-secure modes other than Hyp mode. The difference is:
• The ATS1Cxx operations return the Non-secure PL1 view of these operations. That is, they return the IPA
output address corresponding to the VA input address.
• The ATS12NSOxx operations return the PL2, or Hyp mode, view of these operations. That is, they return the
PA output address corresponding to the VA input address, generated by two stages of translation.
For an implementation that includes the Large Physical Address Extension, see Determining the PAR format, Large
Physical Address Extension on page B3-1437 for the format used when returning the result of these operations.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1435
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.14 Virtual Address to Physical Address translation operations
These operations are UNPREDICTABLE if used in a Secure PL1 mode other than Monitor mode.
These operations perform the translations made by the Non-secure PL2 translation regime. The operation takes a
VA input address and returns a PA output address.
Note
For information about translations when the MMU is disabled see Address translation operations when the MMU
is disabled on page B4-1744.
Table B3-32 shows the encodings for the address translation operations, and their availability in different
implementations in different processor modes and states.
Implementations that include the Security Extensions, in Secure PL1 modes and Non-secure Hyp mode
Implementations that include the Virtualization Extensions, in Non-secure Hyp mode and Secure Monitor mode
a. For more information about these operations see Address translation stage 1, current security state on page B3-1435.
b. For more information about these operations see Address translation stages 1 and 2, Non-secure state only on page B3-1435.
c. For more information about these operations see Address translation stage 1, Hyp mode.
B3-1436 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.14 Virtual Address to Physical Address translation operations
The result of an operation is always returned in the PAR. The PAR is a RW register and:
• in all implementations, the 32-bit format PAR is accessed using an MCR or MRC instruction with CRn set to c7,
CRm set to c4, and opc1 and opc2 both set to 0
• in an implementation that includes the Large Physical Address Extension, the 64-bit format PAR is accessed
using an MCRR or MRRC instruction with CRm set to c7, and opc1 set to 0.
CP15 c7 address translation operations that are not available in a particular implementation are reserved and
UNPREDICTABLE. For example, in an implementation that does not include the Security Extensions, the encodings
with opc2 values of 4-7, and the encodings with an opc1 value of 4, are reserved and UNPREDICTABLE.
ATS1Cxx operations
Address translations for the current state. From modes other than Hyp mode:
• TTBCR.EAE determines whether the result is returned using the 32-bit or the 64-bit PAR
format.
• If the implementation includes the Security Extensions, the translation performed is for the
current security state and, depending on that state:
— the Secure or Non-secure TTBCR.EAE determines the PAR format.
— the result is returned to the Secure or Non-secure copy of the PAR
Operations from Hyp mode always return a result to the Non-secure PAR, using the 64-bit format.
ATS12NSOxx operations
Address translations for the Non-secure PL1 and PL0 modes. These operations return a result using
the 64-bit PAR format if at least one of the following is true:
• the Non-secure TTBCR.EAE bit is set to 1
• the implementation includes the Virtualization Extensions, and HCR.VM is set to 1.
Otherwise, the operation returns a result using the 32-bit PAR format.
Operations from a Secure PL1 mode return a result to the Secure PAR. Operations from Hyp mode
return a result to the Non-secure PAR.
ATS1Hx operations
Address translations from Hyp mode. These operations always return a result using the 64-bit PAR
format.
Operations from Secure Monitor mode return a result to the Secure PAR. Operations from
Non-secure Hyp mode return a result to the Non-secure PAR.
VMSA memory aborts on page B3-1392 describes the faults that might occur on a translation table walk.
How the fault is handled, and whether it generates an exception, depends on the cause of the fault, as described in:
• MMU fault on an address translation operation on page B3-1438
• External abort during an address translation operation on page B3-1438
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1437
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.14 Virtual Address to Physical Address translation operations
Because an address translation operation does not access the output address of the associated address translation,
watchpoints cannot be generated by address translation operations.
• For a faulting address translation operation executed in Hyp mode, or in a Secure PL1 mode.
• For a faulting address translation operation executed in a Non-secure PL1 mode, for cases where the fault
would generate a stage 1 abort if it occurred on the on the equivalent load or store operation.
Using the PAR to report a fault on an address translation operation gives more information about how these faults
are reported.
Note
• The Domain fault encodings shown in Table B3-24 on page B3-1413 are used only for reporting a fault on
an address translation operation that uses the 64-bit PAR format. That is, they are used only in an
implementation that includes the Virtualization Extensions, and are used for reporting a Domain fault on
either:
— an ATS1Cxx operation from Hyp mode
— an ATS12NSOxx operation when HCR.VM is set to 1.
These encodings are never used for fault reporting in the DFSR, IFSR, or HSR.
• For an address translation operation executed in a Non-secure PL1 mode, for a fault that would generate a
stage 2 abort if it occurred on the equivalent load or store operation, the stage 2 abort is generated as described
in Stage 2 fault on a current state address translation operation on page B3-1439.
For a fault on an address translation operation for which no abort is taken, the PAR is updated with the following
information, to indicate the fault:
• The fault code, that would normally be written to the Fault status register. The code used depends on the
current translation table format, as described in either:
— PL1 fault reporting with the Short-descriptor translation table format on page B3-1411
— Fault reporting with the Long-descriptor translation table format on page B3-1413.
See also the Note at the start of Determining the PAR format, Large Physical Address Extension on
page B3-1437 about the Domain fault encodings shown in Table B3-24 on page B3-1413.
B3-1438 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.14 Virtual Address to Physical Address translation operations
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1439
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
Note
Do not confuse this general term, system control registers, with the full name of the SCTLR, described in SCTLR,
System Control Register, VMSA on page B4-1700.
Organization of the CP14 registers in a VMSA implementation on page B3-1464 summarizes the CP14 registers,
and indicates where the CP14 registers are described, either in this manual or in other architecture specifications.
Organization of the CP15 registers in a VMSA implementation on page B3-1465 summarizes the CP15 registers,
and indicates where in this manual the CP15 registers are described.
This section gives general information about the control registers, the CP14 and CP15 interfaces to these registers,
and the conventions used in describing these registers.
Note
Many implementations include other interfaces to some functional groups of CP14 and CP15 registers, for example
memory-mapped interfaces to the CP14 Debug registers. These are described in the appropriate sections of this
manual.
Note
Optionally, an ARMv6 implementation can include some block transfer operations that are accessed using 64-bit
CP15 accesses, see Block transfer operations on page D12-2520.
The Large Physical Address Extension, Virtualization Extensions, and the OPTIONAL Generic Timer introduce a
small number of 64-bit control registers. Accessing 64-bit control registers on page B3-1441 describes how these
registers are accessed.
When using the MCR, MRC, MCRR, and MRRC instructions to access these registers, the instruction arguments include:
• a coprocessor identifier, coproc, as a value p0-p15, corresponding to CP0-CP15
• a coprocessor register, CRn or CRm, as a value c0-c15, to specify a coprocessor register number
• an opcode, opc1 or opc2, as a value in the range 0-7.
B3-1440 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
Note
• When accessing CP15, the primary coprocessor register is the top-level indicator of the accessed
functionality, and when:
— using an MCR or MRC instruction, CRn specifies the primary coprocessor register
— using an MCRR or MRRC instruction, CRm specifies the primary coprocessor register.
• When accessing CP14 using any of these instructions, opc1 is the top-level indicator of the accessed
functionality.
Note
In particular, system control registers holding self-incrementing counts, for example the Performance Monitors
counters or the Generic Timer counter or timers, can be read early. This means that, for example, if a memory
communication is used to communicate a read of the Generic Timer counter, an ISB must be inserted between the
read of the memory location used for this communication and the read of the Generic Timer counter if it is required
that the Generic Timer counter returns a count value that is later than the memory communication.
CP15 and CP14 provides the control registers. A processor access to a specific 32-bit control register uses:
• p15 to specify CP15, or p14 to specify CP14
• a unique combination of CRn, opc1, CRm, and opc2, to specify the required control register
• an ARM core register for the transferred 32-bit value.
CP15 and CP14 provide the control registers. A processor access to a specific 64-bit control register uses:
• p15 to specify CP15, or p14 to specify CP14
• a unique combination of CRm and opc1, to specify the required 64-bit system control register
• two ARM core registers, each holding 32 bits of the value to transfer.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1441
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
• an MRRC instruction to read a control register, see MRRC, MRRC2 on page A8-495.
• Rt contains the least-significant 32 bits of the transferred value, and Rt2 contains the most-significant 32 bits
of that value
The Large Physical Address Extension extends some registers from 32-bits to 64-bits. The MCR and MRC encodings
for these registers access the least significant 32 bits of the register. For example, to access the PAR, software can:
• use the following instructions to access all 64 bits of the register:
MRRC p15, 0, <Rt>, <Rt2>, c7 ; Read 64-bit PAR into Rt (low word) and Rt2 (high word)
MCRR p15, 0, <Rt>, <Rt2>, c7 ; Write Rt (low word) and Rt2 (high word) to 64-bit PAR
• use the following instructions to access the least-significant 32 bits of the register:
MRC p15, 0, <Rt>, c7, c4, 0 ; Read PAR[31:0] into Rt
MCR p15, 0, <Rt>, c7, c4, 0 ; Write Rt to PAR[31:0]
The following sections give information about the general behavior of these registers. Unless otherwise indicated,
information applies to both CP14 and CP15 registers:
• Read-only bits in read/write registers
• UNPREDICTABLE and UNDEFINED behavior for CP14 and CP15 accesses
• Reset behavior of CP14 and CP15 registers on page B3-1446.
See also About system control register accesses on page B3-1440 and Meaning of fixed bit values in register bit
assignment diagrams on page B3-1461.
• all CDP, LDC and STC operations to CP14 and CP15, except for the LDC access to DBGDTRTXint and the STC
access to DBGDTRRXint specified in CP14 debug register interface accesses on page C6-2110
• all MCRR and MRRC operations to CP14 and CP15, except for those explicitly defined as accessing 64-bit CP14
and CP15 registers
• all CDP2, MCR2, MRC2, MCRR2, MRRC2, LDC2, LDCL, LDC2L, STC2, STCL and STC2L operations to CP14 and CP15.
B3-1442 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
The general rules for the behavior of accesses to unallocated register encodings are similar for CP14 and CP15, but
because the primary register specifier is different for CP14 and CP15, the details differ. Therefore, the rules are:
For CP14 For any MCR or MRC access to CP14, the opc1 value for the instruction is the primary specifier for the
functional group of registers accessed, see Organization of the CP14 registers in a VMSA
implementation on page B3-1464. Accesses to unallocated functional groups of registers are
UNDEFINED. This means any access with <opc1> =={2, 3, 4, 5} is UNDEFINED.
For MCR or MRC accesses to an allocated functional group of registers, the behavior of accesses to
unallocated registers in the functional group depends on the group:
opc1==0, Debug registers
The behavior of accesses to unallocated registers depends on the Debug architecture
version, see:
• Access to unallocated CP14 debug register encodings, v7 Debug on
page C6-2124
• Access to unallocated CP14 debug register encodings, v7.1 Debug on
page C6-2133.
opc1==1, Trace registers
See the appropriate trace architecture specification for the behavior of CP14 accesses to
unallocated Trace registers.
opc1=={6, 7}, ThumbEE and Jazelle registers
Accesses to unallocated register encodings are UNPREDICTABLE.
Note
The opc1==7 functional group, the Jazelle registers, can include registers that are
defined by the Jazelle subarchitecture.
For MCRR or MRRC accesses to CP14, all accesses are UNDEFINED unless this manual, or the appropriate
trace architecture specification, explicitly defines them as accessing a 64-bit system register:
• Chapter C11 The Debug Registers identifies valid MCRR or MRRC accesses with opc1==0
• the appropriate trace architecture specification identifies any valid MCRR or MRRC accesses with
opc1==1
• there are no valid MCRR or MRRC accesses with opc1==6 or opc1==7.
For CP15 For an MCR or MRC access to CP15, the CRn value for the instruction is the primary register specifier
for the CP15 space, and the following rules define the behavior of accesses to unallocated
encodings:
1. Accesses to unallocated primary registers are UNDEFINED. For the ARMv7-A Architecture,
this means that:
• For any implementation, accesses to CP15 primary register c4 are UNDEFINED.
• For an implementation that does not include the Security Extensions, accesses to CP15
primary register c12 are UNDEFINED.
• For an implementation that does not include the Generic Timer Extension, accesses to
CP15 primary register c14 are UNDEFINED.
See rule 3 for the behavior of accesses to CP15 primary register c15.
2. In an allocated CP15 primary register, accesses to all unallocated encodings are
UNPREDICTABLE for accesses at PL1 or higher.
This means that any MCR or MRC access from PL1 or higher with a combination of <CRn>,
<opc1>, <CRm> and <opc2> values not shown in, or referenced from, Full list of VMSA CP15
registers, by coprocessor register number on page B3-1475, that would access an allocated
CP15 primary register, is UNPREDICTABLE. As indicated by rule 1, for the ARMv7-A
architecture, the allocated CP15 primary registers are:
• in any VMSA implementation, c0-c3, c5-c11, c13, and c15
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1443
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
3. CP15 primary register c15 is reserved for IMPLEMENTATION DEFINED registers. This means it
is IMPLEMENTATION DEFINED whether this primary register is allocated or unallocated:
• if an implementation does not define any registers in CP15 primary register c15, then
that primary register is unallocated, and all MCR and MRC accesses to it are UNDEFINED
• otherwise, CP15 primary register c15 is allocated, and MCR and MRC accesses to
unallocated encodings with CRn set to c15 are UNPREDICTABLE for accesses at PL1 or
higher.
For MCRR or MRRC accesses to CP15, all accesses are UNDEFINED unless this manual explicitly defines
them as accessing a 64-bit system register. Full list of VMSA CP15 registers, by coprocessor register
number on page B3-1475 identifies the valid MCRR and MRRC accesses to CP15.
Additional rules for MCR and MRC accesses to CP14 and CP15 registers
All MCR operations from the PC are UNPREDICTABLE for all coprocessors, including for CP14 and CP15.
All MRC operations to APSR_nzcv are UNPREDICTABLE for CP14 and CP15, except for the CP14 MRC to APSR_nzcv
shown in CP14 debug register interface accesses on page C6-2110.
Except for CP14 and CP15 encodings that the appropriate register description identifies as accessible by software
executing at PL0, all MCR and MRC accesses from User mode are UNDEFINED. This applies to all User mode accesses
to unallocated CP14 and CP15 encodings.
Some individual registers can be made inaccessible by setting configuration bits, possibly including
IMPLEMENTATION DEFINED configuration bits, to disable access to the register. The effects of the
architecturally-defined configuration bits are defined individually in this manual. Unless explicitly stated otherwise
in this manual, setting a configuration bit to disable access to a register results in the register becoming UNDEFINED
for MRC and MCR accesses.
Effects of the Security Extensions and Virtualization Extensions on CP15 register accesses
The Security Extensions and Virtualization Extensions introduce classes of system control registers, described in
Classification of system control registers on page B3-1447. Some of these classes of register are either:
• accessible only from certain modes or states
• accessible from certain modes or states only when configuration settings permit the access.
Accesses to these registers that are not permitted are UNDEFINED, meaning execution of the register access
instruction generates an Undefined Instruction exception.
Note
This section applies only to registers that are accessible from some modes and states. That is, it applies only to
register access instructions using an encoding that, under some circumstances, would perform a valid register
access.
B3-1444 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
For other Configurable access registers, control bits in the NSACR control the behavior of bits or
fields in the register when it is accessed from Non-secure state. That is, Non-secure accesses to the
register are permitted, but the NSACR controls how they behave. The only architecturally-defined
register of this type is the CPACR.
For more information, see Configurable access system control registers on page B3-1449.
For more information, see Banked PL2-mode CP15 write-only operations on page B3-1452.
In addition, in any implementation that includes the Security Extensions, if write access to a register is disabled by
the CP15SDISABLE signal then any MCR access to that register is UNDEFINED.
If this manual defines a register to be RO at a particular privilege level then, at that privilege level:
• an MCRR access to the register is UNDEFINED, regardless of whether the register can be read by an MRRC
instruction.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1445
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
If this manual defines a register to be WO at a particular privilege level then, at that privilege level:
• an MRRC access to the register is UNDEFINED, regardless of whether the register can be written by an MCRR
instruction.
Note
• This section applies only to registers that this manual defines as RO or WO. It does not apply to registers for
which other access permissions are explicitly defined.
• Although the FPSID is a RO register, a write using the FPSID encoding is a valid serializing operation, see
Asynchronous bounces, serialization, and Floating-point exception barriers on page B1-1237. Such a write
does not access the register.
On reset, the VMSAv7 architecture defines a required reset value for all or part of each of the following CP15
registers:
• The FCSEIDR, if the implementation includes the Fast Context Switch Extension (FCSE). This register is
RAZ/WI when the FCSE is not implemented.
• In an implementation that includes the Security Extensions, the SCR, the Secure copy of the VBAR, and the
NSACR.
• In an implementation that includes the Virtualization Extensions, the VPIDR, VMPIDR, HCR, HDCR,
HCPTR, HSTR, and VTTBR.
• In an implementation that includes the Performance Monitors extension, the PMCR, the PMUSERENR, and
in an implementation of PMUv2, the instance of PMXEVTYPER that relates to the cycle counter.
• In an implementation that includes the Generic Timer Extension, the CNTKCTL and CNTHCTL registers.
Note
In an implementation that includes the Security Extensions, unless this manual explicitly states otherwise, only the
Secure copy of a Banked register is reset to the defined value, and software must program the Non-secure copy of
the register with the required values. Typically, this programming is part of the processor boot sequence.
For details of the reset values of these registers see the register descriptions. If the description of a register or register
field does not include its reset value then the architecture does not require that register or field to reset to a defined
value.
B3-1446 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
The values of all other registers at reset are architecturally UNKNOWN. An implementation can assign an
IMPLEMENTATION DEFINED reset value to a register whose reset value is architecturally UNKNOWN. After a reset,
software must not rely on the value of any read/write register that does not have either an architecturally-defined
reset value or an IMPLEMENTATION DEFINED reset value.
The ResetControlRegisters() pseudocode function resets all CP14 and CP15 registers, and register fields, that have
defined reset values, as described in this section.
Note
For CP14 debug and trace registers this function resets registers as defined for the appropriate level of reset.
Note
• This section describes the effect of the Security Extensions on all of system control registers, including those
that are added by the Security Extensions, or by the Virtualization Extensions.
• The Security Extensions define the register classifications of Banked, Restricted access, Configurable, and
Common. The Virtualization Extensions add the PL2-mode classification. Some of these classifications can
apply to some coprocessor registers other than the CP14 and CP15 system control registers.
It is IMPLEMENTATION DEFINED whether each IMPLEMENTATION DEFINED register is Banked, Restricted access,
Configurable, PL2-mode, or Common.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1447
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
ADFSR, Auxiliary Data Fault Status Register d Read/write only at PL1 or higher
AIFSR, Auxiliary Instruction Fault Status Register d Read/write only at PL1 or higher
c10 PRRR, Primary Region Remap Register Read/write only at PL1 or higher
c12 VBAR, Vector Base Address Register Read/write only at PL1 or higher
TPIDRURW, User Read/Write Thread ID Read/write at all privilege levels, including PL0
a. For accesses to 32-bit registers. More correctly, this is the primary coprocessor register.
b. Any attempt to execute an access that is not permitted results in an Undefined Instruction exception.
c. Some bits are common to the Secure and the Non-secure copies of the register, see SCTLR, System Control Register,
VMSA on page B4-1700.
d. See ADFSR and AIFSR, Auxiliary Data and Instruction Fault Status Registers, VMSA on page B4-1519. Register is
IMPLEMENTATION DEFINED.
e. Banked only in an implementation that includes the FCSE. The FCSE PID Register is RAZ/WI if the FCSE is not
implemented.
B3-1448 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
The System Control Register SCTLR is an example of a register of that contains this mixture of fields.
The Secure copies of the Banked CP15 registers are sometimes referred to as the Secure Banked CP15 registers.
The Non-secure copies of the Banked CP15 registers are sometimes referred to as the Non-secure Banked CP15
registers.
• For all other Restricted access registers, Non-secure software cannot read the register.
Table B3-34 shows the Restricted access CP15 registers in an implementation that includes the Security Extensions.
There are no Restricted access CP14 registers.
c12 MVBAR, Monitor Vector Base Address Read/write in Secure PL1 modes
a. For accesses to 32-bit registers. More correctly, this is the primary coprocessor register.
b. Any attempt to execute an access that is not permitted results in an Undefined Instruction exception.
• A bit in the control register changes the accessibility of a register bit or field. For example, setting a bit in the
control register might mean that a R/W field behaves as RAZ/WI when accessed from Non-secure state.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1449
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
• the following registers in the CP10 and CP11 register space are Configurable access:
— Floating-point Status and Control Register, FPSCR
— Floating-point Exception register, FPEXC
— Floating-point System ID register, FPSID
— Media and VFP Feature Register 0, MVFR0
— Media and VFP Feature Register 1, MVFR1
— Floating-Point Instruction Registers, FPINST and FPINST2, if implemented.
Except for accesses to CNTVOFF in an implementation that includes the Security Extensions but not the
Virtualization Extensions, the behavior of accesses to these registers is as follows:
• in Secure state, the registers can be accessed from Monitor mode when SCR.NS is set to 1, see Access to
registers from Monitor mode on page B3-1455
In an implementation that includes the Security Extensions but not the Virtualization Extensions, the behavior of
accesses to CNTVOFF is as follows:
• any access from Secure Monitor mode is UNPREDICTABLE, regardless of the value of SCR.NS
• all other accesses are UNDEFINED.
Note
Except for CNTVOFF, the Banked PL2-mode registers are part of the Virtualization Extensions, meaning they are
implemented only if the implementation includes the Virtualization Extensions. However, conceptually, CNTVOFF
is part of any implementation that includes the Generic Timer Extension, see Status of the CNTVOFF register on
page B8-1955. This means the behavior of CNTVOFF in an implementation that includes the Generic Timer
Extension but does not include the Virtualization Extensions is not covered by the general definition of the behavior
of the Banked PL2-mode CP15 read/write registers.
B3-1450 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
c0 VPIDR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
VMPIDR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c1 HSCTLR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HACTLR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HCR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HDCR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HCPTR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HSTR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HACR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c2 HTCR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
VTCR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HTTBR 64-bit Read/write. In Non-secure state, accessible only from Hyp mode
VTTBR 64-bit Read/write. In Non-secure state, accessible only from Hyp mode
c5 HADFSRc 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HAIFSRc 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HSR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c6 HPFAR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c10 HMAIR0 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HMAIR1 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HAMAIR0 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
HAMAIR1 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c12 HVBAR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c13 HTPIDR 32-bit Read/write. In Non-secure state, accessible only from Hyp mode
c14 CNTVOFF d 64-bit Read/write. In Non-secure state, accessible only from Hyp mode
a. CRn for accesses to 32-bit registers, CRm for accesses to 64-bit registers. More correctly, this is the primary coprocessor register.
b. Any attempt to execute an access that is not permitted results in an Undefined Instruction exception.
c. See HADFSR and HAIFSR, Hyp Auxiliary Fault Syndrome Registers, Virtualization Extensions on page B4-1572
d. Implemented only in an implementation that includes the Generic Timer Extension. See, also, the Note earlier in this section.
Some Hyp mode registers share the Secure copy of an existing Banked register. In this case the implementation
includes an encoding for the register that is accessible only in Hyp mode, or in Monitor mode when SCR.NS is set
to 1.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1451
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
c6 HDFAR Read/write. In Non-secure state, accessible only from Hyp mode c Secure DFAR
c6 HIFAR Read/write. In Non-secure state, accessible only from Hyp mode c Secure IFAR
a. For accesses to 32-bit registers. More correctly, this is the primary coprocessor register.
b. Any attempt to execute an access that is not permitted results in an Undefined Instruction exception.
c. Also accessible from Monitor mode when SCR.NS set to 1.
In Monitor mode, the Secure copies of these registers can be accessed either:
• using the DFAR or IFAR encoding with SCR.NS set to 0
• using the HDFAR or HIFAR encoding with SCR.NS set to 1.
However, between accessing a register using one alias and accessing the register using the other alias, a Context
synchronization operation is required to ensure the ordering of the accesses.
Architecturally, these encodings are an extension of the Banked register encodings described in Banked system
control registers on page B3-1448, where:
• the processor does not implement the operation in Secure state
• in Non-secure state, the operation is accessible only at PL2, that is, only from Hyp mode.
In Secure state:
• these operations can be accessed from Monitor mode regardless of the value of SCR.NS, see Access to
registers from Monitor mode on page B3-1455
• accesses to these operations are UNPREDICTABLE if executed in a Secure mode other than Monitor mode.
Accesses to these operations are UNDEFINED if accessed from a Non-secure PL1 mode.
Table B3-37 on page B3-1453 shows the PL2-mode CP15 write-only operations:
B3-1452 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
c8 ATS1HR 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
ATS1HW 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
TLBIALLHIS 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
TLBIMVAHIS 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
TLBIALLNSNHIS 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
TLBIALLH 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
TLBIMVAH 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
TLBIALLNSNH 32-bit Write-only. In Non-secure state, accessible only from Hyp mode
a. This section describes the behavior of write accesses that are not permitted. See also Read-only and write-only register encodings
on page B3-1445.
Table B3-38 shows the Common CP15 system control registers in an ARMv7-A implementation that includes the
Security Extensions. These registers are not affected by the implementation of the Security Extensions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1453
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
c7 Cache maintenance operations See Cache maintenance operations, functional group, VMSA on
page B3-1491
Address translation operations See Address translation operations, functional group on page B3-1493
a. For accesses to 32-bit registers. More correctly, this is the primary coprocessor register.
b. Any attempt to execute an access that is not permitted results in an Undefined Instruction exception.
c. Register or operation details are IMPLEMENTATION DEFINED.
In an implementation that includes the Security Extensions, the Non-secure CP15 registers are the CP15 registers
other than the Secure CP15 registers.
Note
The interaction between CP15SDISABLE and any IMPLEMENTATION DEFINED register is IMPLEMENTATION
DEFINED.
Table B3-39 on page B3-1455 shows the registers and operations affected.
B3-1454 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
c2 TTBR0, Translation Table Base Register 0 MCR p15, 0, <Rt>, c2, c0, 0
TTBCR, Translation Table Base Control Register MCR p15, 0, <Rt>, c2, c0, 2
c3 DACR, Domain Access Control Register MCR p15, 0, <Rt>, c3, c0, 0
c10 PRRR. Primary Region Remap Register MCR p15, 0, <Rt>, c10, c2, 0
NMRR, Normal Memory Remap Register MCR p15, 0, <Rt>, c10, c2, 1
c12 VBAR, Vector Base Address Register MCR p15, 0, <Rt>, c12, c0, 0
MVBAR, Monitor Vector Base Address Register MCR p15, 0, <Rt>, c12, c0, 1
c13 FCSEIDR, FCSE PID Register a MCR p15, 0, <Rt>, c13, c0, 0
a. In an implementation that includes the FCSE. The FCSE PID Register is RAZ/WI if the FCSE is not implemented.
On a reset by the external system, the CP15SDISABLE input signal must be taken LOW. This permits the Reset
code to set up the configuration of the Security Extensions. When the input is asserted HIGH, any attempt to write
to the Secure registers shown in Table B3-39 results in an Undefined Instruction exception.
The CP15SDISABLE input does not affect reading Secure registers, or reading or writing Non-secure registers. It
is IMPLEMENTATION DEFINED how the input is changed and when changes to this input are reflected in the processor,
and an implementation might not provide any mechanism for driving the CP15SDISABLE input HIGH. However,
in an implementation in which the CP15SDISABLE input can be driven HIGH, changes in the state of
CP15SDISABLE must be reflected as quickly as possible. Any change must occur before completion of a
Instruction Synchronization Barrier operation, issued after the change, is visible to the processor with respect to
instruction execution boundaries. Software must perform a Instruction Synchronization Barrier operation meeting
the above conditions to ensure all subsequent instructions are affected by the change to CP15SDISABLE.
Use of CP15SDISABLE means key Secure features that are accessible only at PL1 can be locked in a known good
state. This provides an additional level of overall system security. ARM expects control of CP15SDISABLE to
reside in the system, in a block dedicated to security.
NS == 0 Common, Restricted access, and Secure Banked registers are accessed by CP15 MRC, MCR, MRRC and
MCRR instructions.
If the implementation includes the Virtualization Extensions, the registers listed in Banked
PL2-mode CP15 read/write registers on page B3-1450 and PL2-mode encodings for shared CP15
registers on page B3-1451 are not accessible, and any attempt to access them generates an
Undefined Instruction exception.
Note
The operations listed in Banked PL2-mode CP15 write-only operations on page B3-1452 are
accessible in Monitor mode regardless of the value of SCR.NS.
CP15 operations use the security state to determine all resources used, that is, all CP15-based
operations are performed in Secure state.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1455
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
NS == 1 Common, Restricted access and Non-secure Banked registers are accessed by CP15 MRC, MCR, MRRC
and MCRR instructions.
If the implementation includes the Virtualization Extensions, all the registers and operations listed
in the subsections of PL2-mode system control registers on page B3-1450 are accessible, using the
MRC, MCR, MRRC, or MCRR instructions required to access them from Hyp mode.
CP15 operations use the security state to determine all resources used, that is, all CP15-based
operations are performed in Secure state.
The security state determines whether the Secure or Non-secure Banked registers determine the control state.
Note
Where the contents of a register select the value accessed by an MRC or MCR access to a different register, then the
register that is used for selection is being used as control state. For example, CSSELR selects the current CCSIDR,
and therefore CSSELR is used as control state. Therefore, in Monitor mode:
• SCR.NS determines whether the Secure or Non-secure CSSELR is accessible
• because the processor is in Secure state, the Secure CSSELR selects the current CCSIDR.
B3.15.4 Effect of the LPAE and Virtualization Extensions on the system control registers
The Large Physical Address Extension (LPAE) adds:
• two reserved CP15 encodings, for applying IMPLEMENTATION DEFINED memory attributes, AMAIR0 and
AMAIR1.
• the CP15 registers and operations summarized in Virtualization Extensions registers, functional group on
page B3-1496.
• the DBGBXVRs.
B3-1456 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
Note
See Definitions of direct and indirect reads and writes and their side-effects on page B3-1460 for definitions of the
terms direct write, direct read, indirect write, and indirect read.
A direct write to a system control register might become visible at any point after the change to the register, but
without a Context synchronization operation there is no guarantee that the change becomes visible.
Any direct write to a system control register is guaranteed not to affect any instruction that appears, in program
order, before the instruction that performed the direct write, and any direct write to a system control register must
be synchronized before any instruction that appears after the direct write, in program order, can rely on the effect of
that write. The only exceptions to this are:
• All direct writes to the same register, using the same encoding, are guaranteed to occur in program order.
• All direct writes to a register are guaranteed to occur in program order relative to all direct reads of the same
register using the same encoding.
• If an instruction that appears in program order before the direct write performs a memory access, such as a
memory-mapped register access, that causes an indirect read or write to a register, that memory access is
subject to the ARM ordering model. In this case, if permitted by the ARM ordering model, the instruction
that appears in program order before the direct write can be affected by the direct write.
These rules mean that an instruction that writes to one of the address translation operations described in Virtual
Address to Physical Address translation operations on page B3-1434 must be explicitly synchronized to guarantee
that the result of the address translation operation is visible in the PAR.
Note
In this case, the direct write to the encoding of the address translation operation causes an indirect write to the PAR.
Without a Context synchronization operation after the direct write there is no guarantee that the indirect write to the
PAR is visible.
Conceptually, the explicit synchronization occurs as the first step of any Context synchronization operation. This
means that if the operation uses state that had been changed but not synchronized before the operation occurred, the
operation is guaranteed to use the state as if it had been synchronized.
Note
• This explicit synchronization is applied as the first step of the execution of any instruction that causes the
operation. This means it does not synchronize any effect of system registers that might affect the fetch and
decode of the instructions that cause the operation, such as breakpoints or changes to translation tables.
• For a synchronous exception, the control state in use at the time the exception is generated determines the
exception syndrome information, and this syndrome information is not changed by this synchronization at
the start of taking the exception.
Except for the register reads listed in Registers with some architectural guarantee of ordering or observability on
page B3-1459, if no context synchronization operation is performed, direct reads of system control registers can
occur in any order.
Table B3-40 on page B3-1458 shows the synchronization requirement between two reads or writes that access the
same system control register. In the column headings, First and Second refer to:
• Program order, for any read or write caused by the execution of an instruction by this processor, other than a
read or write caused by a memory access made by that instruction.
• The order of arrival of asynchronous reads or writes made by this processor relative to the execution of
instructions by this processor.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1457
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
In addition:
• For indirect reads or writes caused by an external agent, such as a debugger, the mechanism that determines
the order of the reads or writes is defined by that external agent. The external agent can provide mechanisms
that ensure that any reads or writes it makes arrive at the processor. These indirect reads and writes are
asynchronous to software execution on the processor.
• For indirect reads or writes caused by memory-mapped reads or writes made by this processor, the ordering
of the memory accesses is subject to the memory order model, including the effect of the memory type of the
accessed memory address. This applies, for example, if this processor reads or writes one of its registers in a
memory-mapped register interface.
The mechanism for ensuring completion of these memory accesses, including ensuring the arrival of the
asynchronous read or write at the processor, is defined by the system.
Note
Such accesses are likely to be given the Device or Strongly-ordered attribute, but requiring this is outside the
scope of the processor architecture.
• For indirect reads or writes caused by autonomous asynchronous events that count, for example events
caused by the passage of time, the events are ordered so that:
— Counts progress monotonically.
— The events arrive at the processor in finite time and without undue delay.
First read or write Second read or write Context synchronization operation required
Direct write No
Indirect read No a
Direct write No
Indirect write No, but see text in this section for exceptions
Direct write No
Indirect read No
Indirect write No
Indirect write Direct read Yes, but see text in this section for exceptions
Direct write No, but see text in this section for exceptions
Indirect read Yes, but see text in this section for exceptions
Indirect write No, but see text in this section for exceptions
a. Although no synchronization is required between a Direct write and a Direct read, or between a Direct read and an
Indirect write, this does not imply that a Direct read causes synchronization of a previous Direct write. This means
that the sequence Direct write followed by Direct read followed by Indirect read, with no intervening context
synchronization, does not guarantee that the Indirect read observes the result of the Direct write.
B3-1458 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
If the indirect write is to a register that Registers with some architectural guarantee of ordering or observability
shows as having some guarantee of the visibility of an indirect writes, synchronization might not be required.
If a direct read or a direct write to a register is followed by an indirect write to that register that is caused by an
external agent, or by an autonomous asynchronous event, or as a result of a memory-mapped write, then
synchronization is required to guarantee the ordering of the indirect write relative to the direct read or direct write.
If an indirect write caused by a direct write is followed by an indirect write caused by an external agent, or by an
autonomous asynchronous event, or as a result of a memory-mapped write, then synchronization is required to
guarantee the ordering of the two indirect writes.
If a direct read causes an indirect write, synchronization is required to guarantee that the indirect write is visible to
subsequent direct or indirect reads or writes. This synchronization must be performed after the direct read, before
the subsequent direct or indirect reads or writes.
If a direct write causes an indirect write, synchronization is required to guarantee that the indirect write is visible to
subsequent direct or indirect reads or writes. This synchronization must be performed after the direct write, before
the subsequent direct or indirect reads or writes.
Note
Where a register has more that one encoding, a direct write to the register using a particular encoding is not an
indirect write to the same register with a different encoding.
Where an indirect write is caused by the action of an external agent, such as a debugger, or by a memory-mapped
read or write by the processor, then an indirect write by that agent to a register using a particular access mechanism,
followed by an indirect read by that agent to the same register using the same access mechanism and address does
not need synchronization.
For information about the additional synchronization requirements for memory-mapped registers, see
Synchronization requirements for memory-mapped register interfaces on page C6-2103.
To guarantee the visibility of changes to some registers, additional operations might be required before the context
synchronization operation. For such a register, the definition of the register identifies these additional requirements.
For the registers for which Table B3-41 shows that some observability of indirect writes is guaranteed, an indirect
write to the register caused by an external agent, an autonomous asynchronous events, or as a result of a memory
mapped write, is both:
• Observable to direct reads of the register, in finite time, without explicit synchronization.
• Observable to subsequent indirect reads of the register without explicit synchronization.
DBGCLAIMSET - Guaranteed
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1459
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
Table B3-41 Registers with a guarantee of ordering or observability, in a VMSA implementation (continued)
For the specified registers, the observability requirement is more demanding than the observability requirements for
other registers. However, the possibility that direct reads can occur early, in the absence of context synchronization,
described in Ordering of reads of system control registers on page B3-1441, still applies to these registers.
In Debug state, additional synchronization requirements can apply to the registers shown in Table B3-41 on
page B3-1459. For more information, see:
• Synchronization of accesses to the Debug Communications Channel on page C6-2103.
• Synchronization of accesses to the DCC and the DBGITR on page C8-2164.
Definitions of direct and indirect reads and writes and their side-effects
Direct and indirect reads and writes are defined as follows:
Direct read Is a read of a register, using an MRC, MRC2, MRRC, MRRC2, LDC, or LDC2 instruction, that the architecture
permits for the current processor state.
If a direct read of a register has a side-effect of changing the value of a register, the effect of a direct
read on that register is defined to be an indirect write, and has the synchronization requirements of
an indirect write. This means the indirect write is guaranteed to have occurred, and to be visible to
subsequent direct or indirect reads and writes only if synchronization is performed after the direct
read.
Note
The indirect write described here can affect either the register written to by the direct write, or some
other register. The synchronization requirement is the same in both cases.
Direct write Is a write to a register, using an MCR, MCR2, MCRR, MCRR2, STC, or STC2 instruction, that the architecture
permits for the current processor state.
In the following cases, the side-effect of the direct write is defined to be an indirect write of the
affected register, and has the synchronization requirements of an indirect write:
• If the direct write has a side-effect of changing the value of a register other than the register
accessed by the direct write.
• If the direct write has a side-effect of changing the value of the register accessed by the direct
write, so that the value in that register might not be the value that the direct write wrote to the
register.
B3-1460 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
In both cases, this means that the indirect write is not guaranteed to be visible to subsequent direct
or indirect reads and writes unless synchronization is performed after the direct write.
Note
• As an example of a direct write to a register having an effect that is an indirect write of that
register, writing 1 to a PMCNTENCLR.Px bit is also an indirect write, because if the Px bit
had the value 1 before the direct write, the side-effect of the write changes the value of that
bit to 0.
• The indirect write described here can affect either the register written to by the direct write,
or some other register. The synchronization requirement is the same in both cases.
For example, writing 1 to a PMCNTENCLR.Px bit that is set to 1 also changes the
corresponding PMCNTENSET.Px bit from 1 to 0. This means that the direct write to the
PMCNTENCLR defines indirect writes to both itself and to the PMCNTENSET.
Indirect read Is a use of the register by an instruction to establish the operating conditions for the instruction.
Examples of operating conditions that might be determined by an indirect read are the translation
table base address, or whether a cache is enabled.
Indirect reads include situations where the value of one register determines what value is returned
by a second register. This means that any read of the second register is an indirect read of the register
that determines what value is returned.
Indirect reads also include:
• Reads of the system control registers by external agents, such as debuggers, as described in
Chapter C6 Debug Register Interfaces.
• Memory-mapped reads of the system control registers made by the processor that implements
the system control registers.
Where an indirect read of a register has a side-effect of changing the value of a register, that change
is defined to be an indirect write, and has the synchronization requirements of an indirect write.
Note
Taking an exception is a context-synchronizing operation. Therefore, any indirect write performed
as part of an exception entry does not require additional synchronization. This includes the indirect
writes to the registers that report the exception, as described in Exception reporting in a VMSA
implementation on page B3-1406.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1461
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
• software:
— can rely on the bit reading as 0
— must use an SBZP policy to write to the bit.
(0) The Large Physical Address Extension creates a small number of cases where a bit is (0) in some
contexts, and has a different defined behavior in other contexts. The meaning of (0) is modified for
these bits. For a read/write register, this means:
If a register bit is (0) for all uses of the register
• the bit must read as 0
• writes to the bit must be ignored
• software:
— must not rely on the bit reading as 0
— must use an SBZP policy to write to the bit.
Note
This definition applies to all bits marked as (0) in an implementation that does not
include the Large Physical Address Extension.
If a register bit is (0) only for some uses of the register, when that bit is described as (0)
• A read of the bit must return the value last successfully written to the bit,
regardless of the use of the register when the bit was written.
If the bit has not been successfully written since reset, then the read of the bit
returns the reset value if there is one, or otherwise returns an UNKNOWN value.
• A Direct write to the bit must update a storage location associated with the bit.
• An Indirect write to the register sets the bit to 0.
• While the use of the register is such that the bit is described as (0), or as
UNK/SBZP, the value of the bit must have no effect on the operation of the
processor, other than determining the value read back from that bit.
• Software:
— must not rely on the bit reading as 0
— must use an SBZP policy to write to the bit.
Note
This definition applies only to bits that are defined as (0), or as UNK/SBZP, for one use
of a register, and are defined differently for another use of the register.
Fields that are more than one bit wide are sometimes described as UNK/SBZP, instead of having
each bit marked as (0).
In a read-only register, (0) indicates that the bit reads as 0, but software must treat the bit as UNK.
In a write-only register, (0) indicates that software must treat the bit as SBZ.
1 In any implementation:
• the bit must read as 1
• writes to the bit must be ignored.
• software:
— can rely on the bit reading as 1
— must use an SBOP policy to write to the bit.
(1) The Large Physical Address Extension creates a small number of cases where a bit is (1) in some
contexts, and has a different defined behavior in other contexts. The meaning of (1) is modified for
these bits. For a read/write register, this means:
If a register bit is (1) for all uses of the register
• the bit must read as 1
• writes to the bit must be ignored
• software:
— must not rely on the bit reading as 1
— must use an SBOP policy to write to the bit.
B3-1462 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.15 About the system control registers for VMSA
Note
This definition applies to all bits marked as (1) in an implementation that does not
include the Large Physical Address Extension.
If a register bit is (1) only for some uses of the register, when that bit is described as (1)
• A read of the bit must return the value last successfully written to the bit,
regardless of the use of the register when the bit was written.
If the bit has not been successfully written since reset, then the read of the bit
returns the reset value if there is one, or otherwise returns an UNKNOWN value.
• A Direct write to the bit must update a storage location associated with the bit.
• An Indirect write to the register sets the bit to 1.
• While the use of the register is such that the bit is described as (1), or as
UNK/SBOP, the value of the bit must have no effect on the operation of the
processor, other than determining the value read back from that bit.
• Software:
— must not rely on the bit reading as 1
— must use an SBOP policy to write to the bit.
Note
This definition applies only to bits that are defined as (1), or as UNK/SBOP, for one use
of a register, and are defined differently for another use of the register.
Fields that are more than one bit wide are sometimes described as UNK/SBOP, instead of having
each bit marked as (1).
In a read-only register, (1) indicates that the bit reads as 1, but software must treat the bit as UNK.
In a write-only register, (1) indicates that software must treat the bit as SBO.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1463
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.16 Organization of the CP14 registers in a VMSA implementation
Because these functions are so distinct, the descriptions of these registers are distributed, as follows:
• in this manual:
— Chapter C11 The Debug Registers describes the Debug registers
— ThumbEE configuration on page A2-94 summarizes the ThumbEE registers
— Application level configuration and control of the Jazelle extension on page A2-98 summarizes the
Jazelle registers
• the following ARM trace architecture specifications describe the Trace registers:
— Embedded Trace Macrocell Architecture Specification
— CoreSight Program Flow Trace Architecture Specification.
This section summarizes the allocation of the CP14 registers between these different functions, and the CP14
register encodings that are reserved.
The CP14 register encodings are classified by the {CRn, opc1, CRm, opc2} values required to access them using
an MCR or an MRC instruction. The opc1 value determines the primary allocation of these registers, as follows:
opc1==0 Debug registers.
opc1==1 Trace registers.
opc1==6 ThumbEE registers.
opc1==7 Jazelle registers. Can include Jazelle SUBARCHITECTURE DEFINED registers.
Other opc1 values
Reserved.
Note
Primary allocation of CP14 register function by opc1 value differs from the allocation of CP15 registers, where
primary allocation is by CRn value.
For the Debug registers, considering accesses using MCR or MCR instructions:
• For registers with CRn values 0-7, the {CRn, opc2, CRm} values used for accessing the registers map onto
a set of register numbers, as defined in Using CP14 to access debug registers on page C6-2109. These
register numbers define the order of the registers in:
— the memory-mapped interfaces to the registers
— the top-level register summary in Debug register summary on page C11-2181.
Note
Some Debug registers are not visible in some of the Debug register interfaces. For more information see Chapter C6
Debug Register Interfaces.
The ARM trace architectures use the same mapping of {CRn, opc2, CRm} values to register numbers for the Trace
registers. The associated opc1 value determines whether a particular CP14 register number refers to the Trace
register or the Debug register.
B3-1464 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
• Groups the CP15 registers by functional group. For more information about this grouping in a VMSA
implementation, including a summary of each functional group, see Functional grouping of VMSAv7 system
control registers on page B3-1486.
• Describes all of the system control registers for a VMSA implementation, including the CP15 registers, in
Chapter B4 System Control Registers in a VMSA implementation. The description of each register is in the
section VMSA System control registers descriptions, in register order on page B4-1518.
This section gives additional information about the organization of the CP15 registers in a VMSA implementation,
as follows:
Note
The ordered listing of CP15 registers by the {CRn, opc1, CRm, opc2} encoding of the 32-bit
registers is most likely to be useful to those implementing ARMv7 processors, and to those
validating such implementations. However, otherwise, the grouping of registers by function is more
logical.
Views of the registers, that depend on the current state of the processor
See Views of the CP15 registers on page B3-1483.
Note
The different register views are particularly significant in implementations that include the
Virtualization Extensions.
In addition, the indexes in Appendix D18 Registers Index include all of the CP15 registers.
Note
ARMv7 introduced significant changes to the memory system registers, especially in relation to caches. For more
information about:
• how the ARMv7 registers must be used for discovering what caches can be accessed by the processor, see
Identifying the cache resources in ARMv7 on page B2-1265.
• the CP15 register implementation in VMSAv6, see Organization of CP15 registers for an ARMv6 VMSA
implementation on page D12-2510
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1465
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Figure B3-26 CP15 register grouping by primary coprocessor register, CRn, VMSA implementation
Note
Figure B3-26 gives only an overview of the assigned encodings for each of the CP15 primary registers c0-c15. See
the description of each primary register for the definition of the assigned and unassigned encodings for that register,
including any dependencies on whether the implementation includes architectural extensions.
The following sections give the register assignments for each of the CP15 primary registers, c0-c15:
• VMSA CP15 c2 and c3 register summary, Memory protection and control registers on page B3-1469
• VMSA CP15 c5 and c6 register summary, Memory system fault registers on page B3-1470
• VMSA CP15 c7 register summary, Cache maintenance, address translation, and other functions on
page B3-1470
• VMSA CP15 c9 register summary, reserved for cache and TCM control and performance monitors on
page B3-1472
• VMSA CP15 c10 register summary, memory remapping and TLB control registers on page B3-1473
• VMSA CP15 c11 register summary, reserved for TCM DMA registers on page B3-1473
• VMSA CP15 c12 register summary, Security Extensions registers on page B3-1474
• VMSA CP15 c13 register summary, Process, context and thread ID registers on page B3-1474
• VMSA CP15 c14, reserved for Generic Timer Extension on page B3-1474
• VMSA CP15 c15 register summary, IMPLEMENTATION DEFINED registers on page B3-1475.
B3-1466 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
CP15 c0 register encodings not shown in Figure B3-27, and encodings that are part of an unimplemented
architectural extension, are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15 encodings on
page B3-1443.
Note
• Chapter B7 The CPUID Identification Scheme describes the CPUID registers shown in Figure B3-27.
• The CPUID scheme includes information about the implementation of the OPTIONAL Floating-point and
Advanced SIMD architecture extensions. See Advanced SIMD and Floating-point Extensions on page A2-54
for a summary of the implementation options for these features.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1467
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
CP15 c1 register encodings not shown in Figure B3-28, and encodings that are part of an unimplemented
architectural extension, are UNPREDICTABLE. For more information, see Accesses to unallocated CP14 and CP15
encodings on page B3-1443.
B3-1468 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
VMSA CP15 c2 and c3 register summary, Memory protection and control registers
On an ARMv7-A implementation, the CP15 c2 and c3 registers provide memory protection and control.
Figure B3-29 shows the 32-bit registers in CP15 primary registers c2 and c3.
CP15 c2 and c3 32-bit register encodings not shown in Figure B3-29, and encodings that are part of an
unimplemented architectural extension, are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15
encodings on page B3-1443.
On an ARMv7-A implementation that includes the Large Physical Address Extension or Virtualization Extensions,
the CP15 c2 register includes some 64-bit system control registers. Figure B3-29 shows these registers.
CRm opc1
c2 0 TTBR0, Translation Table Base Register 0 §
1 TTBR1, Translation Table Base Register 1 §
4 HTTBR, Hyp Translation Table Base Register ‡
6 VTTBR, Virtualization Translation Table Base Register ‡
Read-only Read/Write Write-only
§ Implemented only as part of the Large Physical Address Extension
‡ Implemented only as part of the Virtualization Extensions
CP15 c2 64-bit register encodings not shown in Figure B3-30 are UNPREDICTABLE, and the allocations shown in
Figure B3-30 are UNPREDICTABLE when the Virtualization Extensions are not implemented. For more information,
see Accesses to unallocated CP14 and CP15 encodings on page B3-1443.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1469
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
CP15 c5 and c6 register encodings not shown in Figure B3-31, and encodings that are part of an unimplemented
architectural extension, are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15 encodings on
page B3-1443.
VMSA CP15 c7 register summary, Cache maintenance, address translation, and other
functions
On an ARMv7-A implementation, the CP15 c7 registers provide cache maintenance operations, address translation
operations, and CP15 versions of the memory barrier operations. Figure B3-32 on page B3-1471 shows the CP15
c7 registers.
B3-1470 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Note
Figure B3-32 shows only those UNPREDICTABLE CP15 c7 encodings that had defined functions in ARMv6.
On an ARMv7-A implementation that includes the Large Physical Address Extension, the CP15 c7 register includes
a 64-bit implementation of the PAR, as Figure B3-33 shows.
CRm opc1
c7 0 PAR, Physical Address Register §
Read-only Read/Write Write-only
§ Implemented only as part of the Large Physical Address Extension
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1471
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
CP15 c7 64-bit register encodings not shown in Figure B3-33 on page B3-1471 are UNPREDICTABLE, and the
allocations shown in Figure B3-33 on page B3-1471 are UNPREDICTABLE when the Large Physical Address
Extension is not implemented. For more information, see Accesses to unallocated CP14 and CP15 encodings on
page B3-1443.
CP15 c8 register encodings not shown in Figure B3-34, and encodings that are part of an unimplemented
architectural extension, are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15 encodings on
page B3-1443.
VMSA CP15 c9 register summary, reserved for cache and TCM control and performance
monitors
ARMv7 reserves some CP15 c9 encodings for IMPLEMENTATION DEFINED memory system functions, in particular:
• cache control, including lockdown
• TCM control, including lockdown
• branch predictor control.
Additional CP15 c9 encodings are reserved for performance monitors. These encodings fall into two groups:
• the OPTIONAL Performance Monitors Extension described in Chapter C12 The Performance Monitors
Extension
• additional IMPLEMENTATION DEFINED performance monitors.
The reserved encodings permit implementations that are compatible with previous versions of the ARM
architecture, in particular with the ARMv6 requirements. Figure B3-35 on page B3-1473 shows the reserved CP15
c9 register encodings in a VMSA implementation.
B3-1472 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
CP15 c9 encodings not shown in Figure B3-35 are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15
encodings on page B3-1443.
VMSA CP15 c10 register summary, memory remapping and TLB control registers
On an ARMv7-A implementation, the CP15 c10 registers provide:
• memory remapping registers
• reserved encodings for IMPLEMENTATION DEFINED TLB control functions, including lockdown.
Figure B3-36 shows the CP15 c10 registers and reserved encodings in a VMSA implementation.
CP15 c10 register encodings not shown in Figure B3-36, and encodings that are part of an unimplemented
architectural extension, are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15 encodings on
page B3-1443.
VMSA CP15 c11 register summary, reserved for TCM DMA registers
ARMv7 reserves some CP15 c11 register encodings for IMPLEMENTATION DEFINED DMA operations to and from
TCM. Figure B3-37 shows the reserved CP15 c11 encodings:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1473
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
CP15 c11 encodings not shown in Figure B3-37 on page B3-1473 are UNPREDICTABLE, see Accesses to unallocated
CP14 and CP15 encodings on page B3-1443.
In an implementation that includes the Security Extensions, CP15 c12 encodings not shown in Figure B3-38, and
encodings that are part of an unimplemented architectural extension, are UNPREDICTABLE. On an implementation
that does not include the Security Extensions all CP15 c12 encodings are UNDEFINED. For more information, see
Accesses to unallocated CP14 and CP15 encodings on page B3-1443.
VMSA CP15 c13 register summary, Process, context and thread ID registers
On an ARMv7-A implementation, the CP15 c13 registers provide:
• an FCSE Process ID Register, that indicates whether the implementation includes the FCSE
• a Context ID Register
• Software Thread ID Registers.
CP15 c13 encodings not shown in Figure B3-39, and encodings that are part of an unimplemented architectural
extension, are UNPREDICTABLE, see Accesses to unallocated CP14 and CP15 encodings on page B3-1443.
Figure B3-40 on page B3-1475 shows the 32-bit CP15 c14 registers in a VMSAv7 implementation that includes the
Generic Timer Extension:
B3-1474 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Figure B3-40 CP15 32-bit c14 registers in a VMSA implementation that includes the Generic Timer Extension
Figure B3-41 shows the 64-bit CP15 c14 registers in a VMSAv7 implementation that includes the Generic Timer
Extension:
CRm opc1
c14 0 CNTPCT, Physical Count register ª
1 CNTVCT, Virtual Count register ª
2 CNTP_CVAL, PL1 Physical Timer CompareValue register ª
3 CNTV_CVAL, Virtual Timer CompareValue register ª
4 CNTVOFF, Virtual Offset register †
6 CNTHP_CVAL, PL2 Physical Timer CompareValue register ‡
Read-only Read/Write Write-only
ª Can be configured as accessible at PL0, see the register description for more information
All registers are implemented only as part of the optional Generic Timer Extension
† Implemented as RW only if the implementation includes the Virtualization Extensions, see the register
description for more information
‡ Implemented only if the implementation includes the Virtualization Extensions
Figure B3-41 CP15 64-bit c14 registers in a VMSA implementation that includes the Generic Timer Extension
• For MCR or MRC accesses to the 32-bit registers, CRn identifies the CP15 primary register used for the access.
• For MCRR or MRRC accesses to the 64-bit registers, CRm identifies the CP15 primary register used for the access.
Table B3-42 on page B3-1476 lists the 64-bit registers with the 32-bit registers accessed using the same CP15
primary register number.
The table also includes links to the descriptions of each of the CP15 primary registers, c0 to c15.
The only UNPREDICTABLE encodings shown in the table are those that had defined functions in ARMv6.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1475
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Table B3-42 Summary of VMSA CP15 register descriptions, in coprocessor register number order
B3-1476 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Table B3-42 Summary of VMSA CP15 register descriptions, in coprocessor register number order (continued)
- 0 c2 - TTBR0e 64-bit
- 1 c2 - TTBR1e 64-bit
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1477
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Table B3-42 Summary of VMSA CP15 register descriptions, in coprocessor register number order (continued)
c7 - PARe 64-bit
2 ATS1CUR 32-bit
3 ATS1CUW 32-bit
4 ATS12NSOPRd 32-bit
5 ATS12NSOPWd 32-bit
6 ATS12NSOUR d 32-bit
7 ATS12NSOUW d 32-bit
c10 1 DCCMVAC 32-bit See Cache and branch predictor maintenance operations,
VMSA on page B4-1735
2 DCCSW 32-bit
c11 1 DCCMVAU 32-bit See Cache and branch predictor maintenance operations,
VMSA on page B4-1735
B3-1478 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Table B3-42 Summary of VMSA CP15 register descriptions, in coprocessor register number order (continued)
c7 0 c14 1 DCCIMVAC 32-bit See Cache and branch predictor maintenance operations,
VMSA on page B4-1735
2 DCCISW 32-bit
2 TLBIASIDIS f 32-bit
3 TLBIMVAAIS f 32-bit
2 ITLBIASID 32-bit
2 DTLBIASID 32-bit
2 TLBIASID 32-bit
3 TLBIMVAA f 32-bit
4 TLBIALLNSNHIS c 32-bit
4 TLBIALLNSNH c 32-bit
c9 0-7 c0-c2 0-7 - 32-bit See Cache and TCM lockdown registers, VMSA on
page B4-1745
c5-c8 0-7 - 32-bit
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1479
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Table B3-42 Summary of VMSA CP15 register descriptions, in coprocessor register number order (continued)
B3-1480 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
Table B3-42 Summary of VMSA CP15 register descriptions, in coprocessor register number order (continued)
c11 0-7 c0-c8 0-7 - 32-bit See DMA support, VMSA on page B4-1746
c15 0-7 c0-c15 0-7 - 32-bit See IMPLEMENTATION DEFINED registers, functional
group on page B3-1497
a. REVIDR is an optional register. If it is not implemented, the encoding with opc2 set to 6 is an alias of MIDR.
b. In some ARMv7 implementations, the AIDR is UNDEFINED.
c. Implemented only as part of the Virtualization Extensions. Otherwise, encoding is unallocated and UNPREDICTABLE, see Accesses to
unallocated CP14 and CP15 encodings on page B3-1443.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1481
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
d. Implemented only as part of the Security Extensions. Otherwise, as described in Accesses to unallocated CP14 and CP15 encodings on
page B3-1443, encoding is unallocated and:
UNDEFINED, for the registers accessed using CRn set to c12.
UNPREDICTABLE, for the register accessed using CRn values other than c12.
e. Implemented only as part of the Large Physical Address Extension. Otherwise, encoding is unallocated and UNPREDICTABLE, see Accesses
to unallocated CP14 and CP15 encodings on page B3-1443.
f. Added as part of the Multiprocessing Extensions. In earlier ARMv7 implementations, encoding is unallocated and UNPREDICTABLE, see
Accesses to unallocated CP14 and CP15 encodings on page B3-1443.
g. When an implementation is using the Long descriptor translation table format these encodings access the MAIRn registers. Otherwise,
including on any implementation that does not include the Large Physical Address Extension, they access the PRRR and NMRR.
h. Implemented only as part of the Generic Timers Extension. Otherwise, encoding is unallocated and UNDEFINED, see Accesses to unallocated
CP14 and CP15 encodings on page B3-1443.
i. Implemented as RW only as part of the Generic Timers Extension on an implementation that includes the Virtualization Extensions. For
more information see Status of the CNTVOFF register on page B8-1955.
B3-1482 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
• the Performance Monitors Extension, see Possible PL0 access to the Performance Monitors Extension CP15
registers
• the Generic Timer Extension, see Possible PL0 access to the Generic Timer Extension CP15 registers.
CP15ISB WO Data and instruction barrier operations, VMSA on page B4-1744 ARM deprecates use of these
operations
CP15DSB WO
CP15DMB WO
In a VMSAv7 implementation that includes the Performance Monitors Extension, when using CP15 to access the
Performance Monitors registers:
For more information, see CP15 c9 performance monitors registers on page C12-2314 and Access permissions on
page C12-2316.
In a VMSAv7 implementation that includes the Generic Timer Extension, when using CP15 to access the Generic
Timer registers:
• If CNTKCTL.PL0PCTEN is set to 1, then if the physical counter register CNTPCT is accessible from PL1
it is also accessible from PL0. For more information see Accessing the physical counter on page B8-1948.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1483
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
• If CNTKCTL.PL0PVTEN is set to 1, the virtual counter register CNTVCT is accessible from PL0. For more
information, see Accessing the virtual counter on page B8-1949.
• If at least one of CNTKCTL.{PL0PCTEN, PL0PVTEN} is set to 1, the CNTFRQ register is RO from PL0.
• If:
— CNTKCTL.PL0PTEN is set to 1, the physical timer registers CNTP_CTL, CNTP_CVAL, and
CNTP_TVAL are accessible from PL0
— CNTKCTL.PL0VTEN is set to 1, the virtual timer registers CNTV_CTL, CNTV_CVAL, and
CNTV_TVAL, are accessible from PL0.
For more information, see Accessing the timer registers on page B8-1952.
B3-1484 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.17 Organization of the CP15 registers in a VMSA implementation
• The registers that are accessible to Non-secure software executing at PL1, as defined in PL1 views of the
CP15 registers on page B3-1484. Access permissions for these registers are identical to those for Non-secure
software executing at PL1.
• The PL2-mode registers summarized in Banked PL2-mode CP15 read/write registers on page B3-1450, and
described in Virtualization Extensions registers, functional group on page B3-1496.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1485
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
These registers are implemented in the CP15 System Control Coprocessor. Therefore, these sections and chapters
describe the CP15 registers for a VMSAv7 implementation.
Table B3-42 on page B3-1476 lists all of the CP15 registers in a VMSAv7 implementation, ordered by:
1. The CP15 primary register used when accessing the register. This is the CRn value for an access to a 32-bit
register, or the CRm value for an access to a 64-bit register.
3. For 32-bit registers, the {CRm, opc2} values used when accessing the register.
An ARMv7 implementation with a PMSA also implements some of the registers described in this chapter. For more
information, see Functional grouping of PMSAv7 system control registers on page B5-1791.
• Coprocessors and system control on page B1-1225 for general information about the System Control
Coprocessor, CP15 and the register access instructions MRC and MCR
• About the system control registers for VMSA on page B3-1440 for general information about the CP15
registers in a VMSA implementation, including:
— their organization, both by CP15 primary registers c0 to c15, and by function
— their general behavior
— the effect of different ARMv7 architecture extensions on the registers
— different views of the registers, that depend on the state of the processor
— conventions used in describing the registers.
The remainder of this chapter, and Chapter B4 System Control Registers in a VMSA implementation, assumes you
are familiar with About the system control registers for VMSA on page B3-1440, and uses conventions and other
information from that section without any explanation.
Each of the following sections summarizes a functional group of VMSA system control registers:
• Identification registers, functional group on page B3-1487
• Virtual memory control registers, functional group on page B3-1488
• PL1 Fault handling registers, functional group on page B3-1489
• Other system control registers, functional group on page B3-1489
• Lockdown, DMA, and TCM features, functional group, VMSA on page B3-1490
• Cache maintenance operations, functional group, VMSA on page B3-1491
• TLB maintenance operations, functional group on page B3-1492
• Address translation operations, functional group on page B3-1493
• Miscellaneous operations, functional group on page B3-1494
• Performance Monitors, functional group on page B3-1495
• Security Extensions registers, functional group on page B3-1495
• Virtualization Extensions registers, functional group on page B3-1496
• Generic Timer Extension registers on page B3-1497
• IMPLEMENTATION DEFINED registers, functional group on page B3-1497.
B3-1486 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
The FPSID, MVFR0, MVFR1, and JIDR hold additional identification information.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1487
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
a. Implemented as part of the Large Physical Address Extension. Otherwise, encodings are unallocated and reserved, see Accesses to
unallocated CP14 and CP15 encodings on page B3-1443
b. Implemented as part of the Large Physical Address Extension. Otherwise, encoding is unallocated and UNDEFINED, see Accesses to
unallocated CP14 and CP15 encodings on page B3-1443.
The IMPLEMENTATION DEFINED ACTLR might provided additional virtual memory control. For more information
see Other system control registers, functional group on page B3-1489.
B3-1488 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
The processor returns fault information using the fault status registers and the fault address registers. For details of
how these registers are used see Exception reporting in a VMSA implementation on page B3-1406.
Note
• These registers also report information about debug exceptions. For more information see:
— Data Abort exceptions, taken to a PL1 mode on page B3-1407
— Prefetch Abort exceptions, taken to a PL1 mode on page B3-1410
— Reporting exceptions taken to the Non-secure PL2 mode on page B3-1417.
• Before ARMv7:
— The DFAR was called the Fault Address Register (FAR).
— The Watchpoint Fault Address Register, DBGWFAR, was implemented in CP15 c6, with <opc2> = 1.
In ARMv7, the DBGWFAR is only implemented as a CP14 debug register.
The Virtualization Extensions include additional fault handling registers. For more information see Virtualization
Extensions registers, functional group on page B3-1496.
a. The FCSEIDR is RO if the processor does not implement the FCSE, and RW otherwise. See the register description for more
information.
The following sections summarize the system control registers added by the corresponding architecture extension:
• Security Extensions registers, functional group on page B3-1495
• Virtualization Extensions registers, functional group on page B3-1496.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1489
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
IMPLEMENTATION DEFINED c9 0-7 c0-c2 32-bit 0-7 a Cache and TCM lockdown registers, VMSA on
page B4-1745
c5-c8 32-bit 0-7 a
c8 32-bit 0-7 a
c11 0-7 c0-c8 32-bit 0-7 a DMA support, VMSA on page B4-1746
B3-1490 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
DCCIMVAC c c7 0 c14 1 32-bit WO Data cache clean and invalidate by MVA PoC
As stated in the table footnote, Cache and branch predictor maintenance operations, VMSA on page B4-1735
describes these operations.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1491
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
a. IS = Inner Shareable.
b. Deprecated. ARM deprecates use of operations that operate only on an Instruction TLB, or only on a Data TLB.
c. The mnemonics for the operations with CRm==c7, opc2=={0, 1, 2} were previously UTLBIALL, UTLBIMVA and UTLBIMASID.
d. The links in this column are to a summary of the operation. TLB maintenance operations, not in Hyp mode on page B4-1738 describes the
operation.
e. Introduced in the Multiprocessing Extensions. In earlier ARMv7 implementations these encodings are unallocated and UNPREDICTABLE, see
Accesses to unallocated CP14 and CP15 encodings on page B3-1443.
TLB maintenance operations, not in Hyp mode on page B4-1738 describes these operations.
The Virtualization Extensions add other TLB operations for use in Hyp mode, see:
• Virtualization Extensions registers, functional group on page B3-1496
• Hyp mode TLB maintenance operations, Virtualization Extensions on page B4-1741.
B3-1492 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
- 0 c7 - 64-bit d RW
a. Implemented only as part of the Security Extensions. Otherwise, encoding is unallocated and UNPREDICTABLE, see Accesses to unallocated
CP14 and CP15 encodings on page B3-1443.
b. Implemented only as part of the Virtualization Extensions. Otherwise, encoding is unallocated and UNPREDICTABLE, see Accesses to
unallocated CP14 and CP15 encodings on page B3-1443.
c. Except for the link to the PAR, the links in this column are to a summary of the operation, and Performing address translation operations
on page B4-1742 describes the operation.
d. Implemented as part of the Large Physical Address Extension. Otherwise, encoding is unallocated and UNPREDICTABLE, see Accesses to
unallocated CP14 and CP15 encodings on page B3-1443.
Performing address translation operations on page B4-1742 describes how to access the address translation
operations. Virtual Address to Physical Address translation operations on page B3-1434 describes these operations.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1493
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
The only UNPREDICTABLE encodings shown in the table are those that had defined functions in ARMv6.
CP15DMB c7 0 c10 5 32-bit WO, PL0 Data and instruction barrier operations, VMSA on
page B4-1744
CP15DSB c7 0 c10 4 32-bit WO, PL0
c13 1 32-bit WO
a. PL0 = Accessible from unprivileged software, that is, from software executing at PL0. See the register description for more information.
b. Implemented only as part of the Virtualization Extensions. Otherwise, encoding is unallocated and UNPREDICTABLE, see Accesses to
unallocated CP14 and CP15 encodings on page B3-1443.
Retired operations
ARMv6 includes two CP15 c7 operations that are not supported in ARMv7, with encodings that become
UNPREDICTABLE in ARMv7. These are the ARMv6:
• Wait For Interrupt (CP15WFI) operation. In ARMv7 this operation is performed by the WFI instruction, that
is available in the ARM and Thumb instruction sets. For more information, see WFI on page A8-1107.
• Prefetch instruction by MVA operation. In ARMv7 this operation is replaced by the PLI instruction, that is
available in the ARM and Thumb instruction sets. For more information, see PLI (immediate, literal) on
page A8-531 and PLI (register) on page A8-533.
In ARMv7, the CP15 c7 encodings that were used for these operations are UNPREDICTABLE. These encodings are:
• for the ARMv6 CP15WFI operation:
— an MCR instruction with <opc1> set to 0, <CRn> set to c7, <CRm> set to c0, and <opc2> set to 4
• for the ARMv6 Prefetch instruction by MVA operation:
— an MCR instruction with <opc1> set to 0, <CRn> set to c7, <CRm> set to c13, and <opc2> set to 1.
Note
In some ARMv7 implementations, these encodings are write-only operations that perform a NOP.
B3-1494 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
c9 0-7 c12-c14 0-7 See Performance Monitors registers on 32-bit RW or Performance monitors
page C12-2314 a RO b
a. The referenced section describes the registers defined by the recommended Performance Monitors Extension.
b. The section referenced in footnote a shows the type of each of the recommended Performance Monitors Extension registers.
c. Access depends on the register or operation, and is IMPLEMENTATION DEFINED.
Performance monitors
ARMv7 reserves some encodings in the system control register space for performance monitors. These provide
encodings for:
• The OPTIONAL Performance Monitors Extension registers, summarized in Performance Monitors registers
on page C12-2314.
• Optional additional IMPLEMENTATION DEFINED performance monitors. Table B3-53 shows these reserved
encodings.
All the encodings shown in Table B3-54 are unallocated and UNPREDICTABLE on a processor that does not
implement the Security Extensions, see Accesses to unallocated CP14 and CP15 encodings on page B3-1443.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1495
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
Table B3-55 Virtualization Extensions registers, VMSA with Virtualization Extensions only
- c8 4 c3 {0, 1, 4} 32-bit WO Table B3-56 on page B3-1497 and Hyp mode TLB
maintenance operations, Virtualization Extensions on
c7 {0, 1, 4} 32-bit WO page B4-1741
Table B3-56 on page B3-1497 lists the TLB maintenance operations added in this functional group and summarized
in Table B3-55.
B3-1496 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.18 Functional grouping of VMSAv7 system control registers
Table B3-56 Hyp mode TLB maintenance operations, VMSA with Virtualization Extensions only
a. IS = Inner Shareable.
b. The links in this column are to a summary of the operation, and Hyp mode TLB maintenance operations, Virtualization Extensions on
page B4-1741 describes the operation.
All the encodings shown in Table B3-55 on page B3-1496 are unallocated and UNPREDICTABLE on a processor that
does not implement the Virtualization Extensions, see Accesses to unallocated CP14 and CP15 encodings on
page B3-1443.
In addition to the registers shown in Table B3-55 on page B3-1496, the Virtualization Extensions add:
• the ATS1H* address translation operations, see Address translation operations, functional group on
page B3-1493 and Performing address translation operations on page B4-1742
Typically, an implementation uses CP15 c15 to provide test features, and any required configuration options that
are not covered by this manual.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1497
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
See also the pseudocode for general memory system operations in Pseudocode details of general memory system
operations on page B2-1291.
// AlignmentFaultV()
// =================
mva = FCSETranslate(address);
DataAbort(mva, ipaddress, domain, level, iswrite, DAbort_Alignment, taketohyp,
secondstageabort, ipavalid, LDFSRformat, s2fs1walk);
// FCSETranslate()
// ===============
B3-1498 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
// TranslateAddressV()
// ===================
AddressDescriptor result;
s2fs1walk = FALSE;
mva = FCSETranslate(va);
ishyp = CurrentModeIsHyp();
if HaveVirtExt() && !IsSecure() && !ishyp && HCR.TGE == '1' then UNPREDICTABLE;
usesLD = ishyp || TTBCR.EAE == '1';
if usesLD then
ia_in = '00000000':mva;
tlbrecordS1 = TranslationTableWalkLD(ia_in, mva, iswrite, TRUE, s2fs1walk, size);
checkdomain = FALSE;
checkpermission = TRUE;
else
tlbrecordS1 = TranslationTableWalkSD(mva, iswrite, size);
checkdomain = TRUE;
checkpermission = TRUE;
else
tlbrecordS1 = TranslateAddressVS1Off(mva);
checkdomain = FALSE;
checkpermission = FALSE;
if checkpermission then
CheckPermission(tlbrecordS1.perms, mva, tlbrecordS1.level, tlbrecordS1.domain, iswrite,
ispriv, ishyp, usesLD);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1499
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
// Check permissions
CheckPermissionS2(tlbrecordS2.perms, mva, s1outputaddr,
tlbrecordS2.level, iswrite, s2fs1walk);
result = CombineS1S2Desc(tlbrecordS1.addrdesc, tlbrecordS2.addrdesc);
else
result = tlbrecordS1.addrdesc;
else
result = tlbrecordS1.addrdesc;
return result;
Stage 2 translation table walk on page B3-1511 describes the CheckPermissionS2() and CombineS1S2Desc()
pseudocode functions.
// TranslateAddressVS1Off()
// ========================
// Only called for data accesses. Does not define instruction fetch behavior.
TLBRecord result;
return result;
B3-1500 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
// CheckDomain()
// =============
bitpos = 2*UInt(domain);
case DACR<bitpos+1:bitpos> of
when '00' DataAbort(mva, ipaddress, domain, level, iswrite, DAbort_Domain, taketohypmode,
secondstageabort, ipavalid, LDFSRformat, s2fs1walk);
when '01' permissioncheck = TRUE;
when '10' UNPREDICTABLE;
when '11' permissioncheck = FALSE;
return permissioncheck;
type TLBRecord is (
Permissions perms,
bit nG, // '0' = Global, '1' = not Global
bits(4) domain,
boolean contiguousbit,
integer level, // generalises Section/Page to Table level
integer blocksize, // describes size of memory translated in KBytes
AddressDescriptor addrdesc
)
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1501
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
Translation table walk using the Short-descriptor translation table format for stage 1
The TranslationTableWalkSD() pseudocode function describes the translation table walk when the stage 1 translation
tables use the Short-descriptor format. It calls the function described in Stage 2 translation table walk on
page B3-1511 if necessary:
// TranslationTableWalkSD()
// ========================
//
// Returns a result of a translation table walk using
// the Short-descriptor format for TLBRecord
//
// Implementations might cache information from memory in any
// number of non-coherent TLB caching structures, and so avoid
// memory accesses that have been expressed in this pseudocode
// The use of such TLBs is not expressed in this pseudocode.
if HaveMPExt() then
hintsattrs = ConvertAttrsHints(ttbr<0>:ttbr<6>);
l1descaddr.memattrs.innerattrs = hintsattrs<1:0>;
l1descaddr.memattrs.innerhints = hintsattrs<3:2>;
else
if ttbr<0> == '0' then
B3-1502 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
hintsattrs = ConvertAttrsHints('00');
l1descaddr.memattrs.innerattrs = hintsattrs<1:0>;
l1descaddr.memattrs.innerhints = hintsattrs<3:2>;
else
l1descaddr.memattrs.innerattrs = IMPLEMENTATION_DEFINED 10 or 11;
l1descaddr.memattrs.innerhints = IMPLEMENTATION_DEFINED 01 or 11;
S = l2desc<10>;
ap = l2desc<9,5:4>;
nG = l2desc<11>;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1503
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
physicaladdressext = '00000000';
physicaladdress = l2desc<31:16>:mva<15:0>;
else // Small page
texcb = l2desc<8:6,3,2>;
xn = l2desc<0>;
blocksize = 4;
physicaladdressext = '00000000';
physicaladdress = l2desc<31:12>:mva<11:0>;
// Decode the TEX, C, B and S bits to produce the TLBRecord's memory attributes
if SCTLR.TRE == '0' then
if RemapRegsHaveResetValues() then
result.addrdesc.memattrs = DefaultTEXDecode(texcb, S);
else
IMPLEMENTATION_DEFINED setting of result.addrdesc.memattrs;
else
result.addrdesc.memattrs = RemappedTEXDecode(texcb, S);
// Set the rest of the TLBRecord, try to add it to the TLB, and return it.
result.perms.ap = ap;
result.perms.xn = xn;
result.perms.pxn = pxn;
result.nG = nG;
result.domain = domain;
result.level = level;
result.blocksize = blocksize;
result.addrdesc.paddress.physicaladdress = physicaladdressext:physicaladdress;
result.addrdesc.paddress.NS = if IsSecure() then NS else '1';
return result;
B3-1504 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
The ConvertAttrsHints() pseudocode function converts the Normal memory cacheability attribute, from the
translation table base register or the translation table TEX field, into the separate cacheability attribute and cache
allocation hint defined in a Long-descriptor translation table descriptor:
// ConvertAttrsHints()
// ===================
return hints:attributes;
Translation table walk using the Long-descriptor translation table format for stage 1
The TranslationTableWalkLD() pseudocode function describes the translation table walk when the stage 1 translation
tables use the Long-descriptor format. It calls the function described in Stage 2 translation table walk on
page B3-1511 if necessary:
// TranslationTableWalkLD()
// ========================
//
// Returns a result of a translation table walk using
// the longdescriptor in TLBRecord form
//
// Implementations might cache information from memory in any
// number of non-coherent TLB caching structures, and so avoid
// memory accesses that have been expressed in this pseudocode
// The use of such TLBs is not expressed in this pseudocode.
TLBRecord result;
AddressDescriptor walkaddr;
if stage1 then
if CurrentModeIsHyp() then
// executing in Hyp mode
LookupSecure = FALSE;
T0Size = UInt(HTCR.T0SZ);
if T0Size == 0 || IsZero(IA<31:(32-T0Size)>) then
CurrentLevel = (if HTCR.T0SZ<2:1> == '00' then 1 else 2);
BALowerBound = 9*CurrentLevel - T0Size - 4;
BaseAddress = HTTBR<39:BALowerBound>:Zeros(BALowerBound);
if !IsZero(HTTBR<BALowerBound-1:3>) then UNPREDICTABLE;
BaseFound = TRUE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1505
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
StartBit = 31-T0Size;
else
// not executing in Hyp mode
LookupSecure = IsSecure();
T0Size = UInt(TTBCR.T0SZ);
if T0Size == 0 || IsZero(IA<31:(32-T0Size)>) then
CurrentLevel = (if TTBCR.T0SZ<2:1> == '00' then 1 else 2);
BALowerBound = 9*CurrentLevel - T0Size - 4;
BaseAddress = TTBR0<39:BALowerBound>:Zeros(BALowerBound);
if !IsZero(TTBR0<BALowerBound-1:3>) then UNPREDICTABLE;
BaseFound = TRUE;
Disabled = (TTBCR.EPD0 == '1');
StartBit = 31-T0Size;
T1Size = UInt(TTBCR.T1SZ);
if (T1Size == 0 && !BaseFound) || IsOnes(IA<31:(32-T1Size)>) then
CurrentLevel = (if TTBCR.T1SZ<2:1> == '00' then 1 else 2);
BALowerBound = 9*CurrentLevel - T1Size - 4;
BaseAddress = TTBR1<39:BALowerBound>:Zeros(BALowerBound);
if !IsZero(TTBR1<BALowerBound-1:3>) then UNPREDICTABLE;
BaseFound = TRUE;
Disabled = (TTBCR.EPD1 == '1');
StartBit = 31-T1Size;
else
// not a stage 1 translation
T0Size = SInt(VTCR.T0SZ);
SLevel = UInt(VTCR.SL0);
BALowerBound = 14 - T0Size - 9*SLevel;
// check UNPREDICTABLE combinations of the Starting level and Size fields
// and check the VTTBR is aligned correctly
B3-1506 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
FirstIteration = TRUE;
TableRW = TRUE;
TableUser = TRUE;
TableXN = FALSE;
TablePXN = FALSE;
repeat
LookUpFinished = TRUE;
BlockTranslate = FALSE;
Offset = 9*CurrentLevel;
if FirstIteration then
IASelect = ZeroExtend(IA<StartBit:39-Offset>:'000', 40);
else
IASelect = ZeroExtend(IA<47-Offset:39-Offset>:'000', 40);
LookupAddress = BaseAddress OR IASelect;
FirstIteration = FALSE;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1507
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
Descriptor = BigEndianReverse(Descriptor,8);
if BlockTranslate then
OutputAddress = Descriptor<39:39-Offset> : IA<38-Offset:0>;
Attrs = Descriptor<54:52>: Descriptor<11:2>;
if stage1 then
if TableXN then Attrs<12> = '1';
if TablePXN then Attrs<11> = '1';
if IsSecure() && !(LookupSecure) then Attrs<9> = '1';
if !(TableRW) then Attrs<5> = '1';
if !(TableUser) then Attrs<4> = '0';
if !(LookupSecure) then Attrs<3> = '1';
else
CurrentLevel = CurrentLevel + 1;
until LookUpFinished;
B3-1508 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
result.perms.xn = Attrs<12>;
result.perms.pxn = Attrs<11>;
result.contiguousbit = Attrs<10>;
result.nG = Attrs<9>;
result.perms.ap<2:1> = Attrs<5:4>;
result.perms.ap<0> = '1';
if stage1 then
result.addrdesc.memattrs = MAIRDecode(Attrs<2:0>);
else
result.addrdesc.memattrs = S2AttrDecode(Attrs<3:0>);
if stage1 then
result.addrdesc.paddress.NS = Attrs<3>;
else
result.addrdesc.paddress.NS = '1';
return result;
This function calls the ConvertAttrsHints() pseudocode function that is defined in Translation table walk using the
Short-descriptor translation table format for stage 1 on page B3-1502.
The MAIRDecode() pseudocode function uses the MAIRn registers to decode the Attr[2:0] value from a stage 1
translation table descriptor:
// MAIRDecode()
// ============
MemoryAttributes memattrs;
if CurrentModeIsHyp() then
mair = HMAIR1:HMAIR0;
else
mair = MAIR1:MAIR0;
index = UInt(attr);
attrfield = mair<8*index+7:8*index>;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1509
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
if unpackinner then
if attrfield<3> == '1' then
memattrs.innerhints = attrfield<1:0>;
memattrs.innerattrs = attrfield<3:2>;
memattrs.innertransient = FALSE;
elsif attrfield<2:0> == '100' then // Non-cacheable
memattrs.innerhints = '00';
memattrs.innerattrs = '00';
memattrs.innertransient = TRUE;
else
if ImplementationSupportsTransient() then
if attrfield<2> == '0' then
memattrs.innerhints = attrfield<1:0>;
memattrs.innerattrs = '10'; //Write-through
memattrs.innertransient = TRUE;
B3-1510 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
else
memattrs.innerhints = attrfield<1:0>;
memattrs.innerattrs = '11'; //Write-back
memattrs.innertransient = TRUE;
else
memattrs.type = IMPLEMENTATION_DEFINED;
memattrs.innerattrs = IMPLEMENTATION_DEFINED;
memattrs.innerhints = IMPLEMENTATION_DEFINED;
memattrs.innertransient = IMPLEMENTATION_DEFINED;
memattrs.outerattrs = IMPLEMENTATION_DEFINED;
memattrs.outerhints = IMPLEMENTATION_DEFINED;
memattrs.outertransient = IMPLEMENTATION_DEFINED;
return memattrs;
The S2AttrDecode() pseudocode function decodes the Attr[3:0] value from a stage 2 translation table descriptor:
// S2AttrDecode()
// ==============
// Converts the Stage 2 attribute fields into
// orthogonal attributes and hints
MemoryAttributes memattrs;
return memattrs;
// SecondStageTranslate()
// ======================
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1511
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
AddressDescriptor result;
TLBRecord tlbrecordS2;
return;
The CheckPermissionS2() pseudocode function checks the access permissions for the stage 2 translation.
Note
Access permission checking on page B2-1297 describes the equivalent function for stage 1 translations, because that
function is also used in the PMSA pseudocode.
// CheckPermissionS2()
// ===================
if abort then
domain = bits(4) UNKNOWN;
taketohypmode = TRUE;
secondstageabort = TRUE;
ipavalid = s2fs1walk;
LDFSRformat = TRUE;
DataAbort(mva, ipa, domain, level, iswrite, DAbort_Permission,
taketohypmode, secondstageabort, ipavalid, LDFSRformat,
s2fs1walk);
return;
The CombineS1S2Desc() pseudocode function combines the stage 1 and stage 2 address descriptors:
// CombineS1S2Desc()
// =================
B3-1512 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
AddressDescriptor result;
result.paddress = s2desc.paddress;
// default values:
result.memattrs.innerattrs = bits(2) UNKNOWN;
result.memattrs.outerattrs = bits(2) UNKNOWN;
result.memattrs.innerhints = bits(2) UNKNOWN;
result.memattrs.outerhints = bits(2) UNKNOWN;
result.memattrs.shareable = TRUE;
result.memattrs.outershareable = TRUE;
if s2desc.memattrs.type == MemType_StronglyOrdered ||
s1desc.memattrs.type == MemType_StronglyOrdered then
result.memattrs.type = MemType_StronglyOrdered;
if s2desc.memattrs.innerattrs == '01' ||
s1desc.memattrs.innerattrs == '01' then
// either encoding reserved
result.memattrs.innerattrs = bits(2) UNKNOWN;
elsif s2desc.memattrs.innerattrs == '00' ||
s1desc.memattrs.innerattrs == '00' then
// either encoding Non-cacheable
result.memattrs.innerattrs = '00';
elsif s2desc.memattrs.innerattrs == '10' ||
s1desc.memattrs.innerattrs == '10' then
// either encoding Write-Through cacheable
result.memattrs.innerattrs = '10';
else
// both encodings Write-Back
result.memattrs.innerattrs = '11';
if s2desc.memattrs.outerattrs == '01' ||
s1desc.memattrs.outerattrs == '01' then
// either encoding reserved
result.memattrs.outerattrs = bits(2) UNKNOWN;
if s2desc.memattrs.outerattrs == '00' ||
s1desc.memattrs.outerattrs == '00' then
// either encoding Non-cacheable
result.memattrs.outerattrs = '00';
elsif s2desc.memattrs.outerattrs == '10' ||
s1desc.memattrs.outerattrs == '10' then
// either encoding Write-Through cacheable
result.memattrs.outerattrs = '10';
else
// both encodings Write-Back
result.memattrs.outerattrs = '11';
result.memattrs.innerhints = s1desc.memattrs.innerhints;
result.memattrs.outerhints = s1desc.memattrs.outerhints;
result.memattrs.shareable = (s1desc.memattrs.shareable ||
s2desc.memattrs.shareable);
result.memattrs.outershareable = (s1desc.memattrs.outershareable ||
s2desc.memattrs.outershareable);
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1513
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
return result;
// WriteHSR()
// ==========
// Writes a syndrome into the HSR
HSRValue<31:26> = ec;
// HSR.IL not valid for unknown reasons (0x00), Prefetch Aborts (0x20, 0x21), and Data
// Aborts (0x24, 0x25) for which the ISS information is not valid.
if UInt(ec) IN {0x00,0x20,0x21) || (UInt(ec) IN {0x24,0x25} && HSRString<24> == '1') then
HSRValue<25> = if ThisInstrLength() == 32 then '1' else '0';
HSR = HSRValue;
return;
// CallHypervisor()
// ================
//
// Performs a HVC call
CallHypervisor(bits(16) immediate)
HSRString = Zeros(25);
HSRString<15:0> = immediate;
WriteHSR('010010', HSRString);
TakeHVCException();
B3-1514 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
// RemappedTEXDecode()
// ===================
MemoryAttributes memattrs;
bits(4) hintsattrs;
region = UInt(texcb<2:0>); // texcb<4:3> are ignored in this mapping scheme
if region == 6 then
IMPLEMENTATION_DEFINED setting of memattrs;
else
case PRRR<(2*region+1):2*region> of
when '00'
memattrs.type = MemType_StronglyOrdered;
memattrs.innerattrs = bits(2) UNKNOWN;
memattrs.outerattrs = bits(2) UNKNOWN;
memattrs.innerhints = bits(2) UNKNOWN;
memattrs.outerhints = bits(2) UNKNOWN;
memattrs.shareable = TRUE;
memattrs.outershareable = TRUE;
when '01'
memattrs.type = MemType_Device;
memattrs.innerattrs = bits(2) UNKNOWN;
memattrs.outerattrs = bits(2) UNKNOWN;
memattrs.innerhints = bits(2) UNKNOWN;
memattrs.outerhints = bits(2) UNKNOWN;
memattrs.shareable = TRUE;
memattrs.outershareable = TRUE;
when '10'
memattrs.type = MemType_Normal;
hintsattrs = ConvertAttrsHints(NMRR<(2*region+1):2*region>);
memattrs.innerattrs = hintsattrs<1:0>;
memattrs.innerhints = hintsattrs<3:2>;
hintattrs = ConvertAttrsHints(NMRR<(2*region+17):(2*region+16)>);
memattrs.outerattrs = hintsattrs<1:0>;
memattrs.outerhints = hintsattrs<3:2>;
return memattrs;
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B3-1515
ID040418 Non-Confidential
B3 Virtual Memory System Architecture (VMSA)
B3.19 Pseudocode details of VMSA memory system operations
B3-1516 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
Chapter B4
System Control Registers in a VMSA
implementation
This chapter describes the system control registers in a VMSA implementation. The registers are described in
alphabetic order. The chapter contains the following sections:
• VMSA System control registers descriptions, in register order on page B4-1518.
• VMSA system control operations described by function on page B4-1735.
Note
The architecture defines some registers identically for VMSAv7 and PMSAv7 implementations. Those registers are
described fully both in this chapter and in Chapter B6 System Control Registers in a PMSA implementation.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1517
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Some register encodings provide functions that form part of a closely-related functional group, for example, the
encodings for cache maintenance operations. VMSA system control operations described by function on
page B4-1735 describes these operations. However, operations that have an architecturally-defined name also have
an alphabetic entry in VMSA System control registers descriptions, in register order. For example, the DCCISW
cache maintenance operation has a short entry in this section, DCCISW, Data Cache Clean and Invalidate by
Set/Way, VMSA on page B4-1555, that references its full description in Cache and branch predictor maintenance
operations, VMSA on page B4-1735.
Purpose The ACTLR provides IMPLEMENTATION DEFINED configuration and control options.
This register is part of the Other system control registers functional group.
Configurations If the implementation includes the Security Extensions, this register is Banked. However,
some bits might define global configuration settings, and be common to the Secure and
Non-secure copies of the register.
Attributes A 32-bit RW register. Because the register is IMPLEMENTATION DEFINED, the register reset
value is IMPLEMENTATION DEFINED. See also Reset behavior of CP14 and CP15 registers
on page B3-1446.
Table B3-47 on page B3-1489 shows the encodings of all of the registers in the Other
system control registers functional group.
The contents of this register are IMPLEMENTATION DEFINED. ARMv7 requires this register to be PL1 read/write
accessible, even if the implementation has not created any control bits in this register.
B4-1518 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.2 ADFSR and AIFSR, Auxiliary Data and Instruction Fault Status Registers, VMSA
The ADFSR and AIFSR characteristics are:
Purpose The AxFSRs can provide additional IMPLEMENTATION DEFINED fault status information, see
Auxiliary Fault Status Registers on page B3-1407.
These registers are part of the PL1 Fault handling registers functional group.
Configurations These registers are not implemented in architecture versions before ARMv7.
If the implementation includes the Security Extensions, these registers are Banked.
Attributes 32-bit RW registers. Because these registers are IMPLEMENTATION DEFINED, the reset values
are IMPLEMENTATION DEFINED. See also Reset behavior of CP14 and CP15 registers on
page B3-1446.
Table B3-46 on page B3-1489 shows the encodings of all of the registers in the PL1 Fault
handling registers functional group.
For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1519
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Attributes A 32-bit RO register with an IMPLEMENTATION DEFINED value. See also Reset behavior of
CP14 and CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
The AIDR bit assignments are IMPLEMENTATION DEFINED.
B4-1520 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.5 AMAIR0 and AMAIR1, Auxiliary Memory Attribute Indirection Registers 0 and 1, VMSA
The AMAIR0 and AMAIR1 characteristics are:
Purpose When using the Long-descriptor format translation tables for stage 1 translations, AMAIR0
and AMAIR1 provide IMPLEMENTATION DEFINED memory attributes for the memory
regions specified by the MAIRn registers.
These registers are part of the Virtual memory control registers functional group.
Configurations AMAIR0 and AMAIR1 are implemented only as part of the Large Physical Address
Extension. In an implementation that includes the Security Extensions they:
• Are Banked.
• Have write access to the Secure copy of the register disabled when the
CP15SDISABLE signal is asserted HIGH.
Attributes 32-bit RW registers with UNKNOWN reset values. See also Reset behavior of CP14 and CP15
registers on page B3-1446.
Table B3-45 on page B3-1488 shows the encodings of all of the registers in the Virtual
memory control registers functional group.
Note
In a typical implementation, AMAIR0 and AMAIR1 split into eight one-byte fields, corresponding to the
MAIRn.Attrm fields, but the architecture does not require them to do so.
Any IMPLEMENTATION DEFINED memory attributes are additional qualifiers for the memory locations and must not
change the architected behavior specified by the MAIRn registers.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1521
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.6 ATS12NSOPR, Address Translate Stages 1 and 2 Non-secure PL1 Read, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.7 ATS12NSOPW, Address Translate Stages 1 and 2 Non-secure PL1 Write, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.8 ATS12NSOUR, Address Translate Stages 1 and 2 Non-secure Unprivileged Read, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.9 ATS12NSOUW, Address Translate Stages 1 and 2 Non-secure Unprivileged Write, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.10 ATS1CPR, Address Translate Stage 1 Current state PL1 Read, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.11 ATS1CPW, Address Translate Stage 1 Current state PL1 Write, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.12 ATS1CUR, Address Translate Stage 1 Current state Unprivileged Read, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.13 ATS1CUW, Address Translate Stage 1 Current state Unprivileged Write, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4.1.14 ATS1HR, Address Translate Stage 1 Hyp mode Read, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
B4-1522 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.15 ATS1HW, Address Translate Stage 1 Hyp mode Write, VMSA only
Performing address translation operations on page B4-1742 describes this address translation operation.
This operation is part of the Address translation operations functional group. Table B3-51 on page B3-1493 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1523
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The CCSIDR provides information about the architecture of the caches.
This register is part of the Identification registers functional group.
Configurations The implementation includes one CCSIDR for each cache that it can access. CSSELR
selects which Cache Size ID Register is accessible.
Architecture versions before ARMv7 do not define these registers.
If the implementation includes the Security Extensions, these registers are Common.
Attributes A 32-bit RO register with an IMPLEMENTATION DEFINED value. See also Reset behavior of
CP14 and CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
WA
RA
WB
WT
WT, bit[31] Indicates whether the cache level supports write-through, see Table B4-1.
WB, bit[30] Indicates whether the cache level supports write-back, see Table B4-1.
RA, bit[29] Indicates whether the cache level supports read-allocation, see Table B4-1.
WA, bit[28] Indicates whether the cache level supports write-allocation, see Table B4-1.
1 Feature supported
NumSets, bits[27:13]
(Number of sets in cache) - 1, therefore a value of 0 indicates 1 set in the cache. The number of sets
does not have to be a power of 2.
Associativity, bits[12:3]
(Associativity of cache) - 1, therefore a value of 0 indicates an associativity of 1. The associativity
does not have to be a power of 2.
LineSize, bits[2:0]
(Log2(Number of words in cache line)) -2. For example:
• For a line length of 4 words: Log2(4) = 2, LineSize entry = 0.
B4-1524 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
The parameters NumSets, Associativity, and LineSize in these registers define the architecturally
visible parameters that are required for the cache maintenance by Set/Way instructions. They are not
guaranteed to represent the actual microarchitectural features of a design. You cannot make any
inference about the actual sizes of caches based on these parameters.
Any access to the CCSIDR when the value in CSSELR corresponds to a cache that is not implemented returns an
UNKNOWN value.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1525
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Attributes A 32-bit RO register with an IMPLEMENTATION DEFINED value. See also Reset behavior of
CP14 and CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
(0) (0) LoUU LoC LoUIS Ctype7 Ctype6 Ctype5 Ctype4 Ctype3 Ctype2 Ctype1
LoUU, bits[29:27]
Level of Unification Uniprocessor for the cache hierarchy, see Terminology for Clean, Invalidate,
and Clean and Invalidate operations on page B2-1273.
LoC, bits[26:24]
Level of Coherence for the cache hierarchy, see Terminology for Clean, Invalidate, and Clean and
Invalidate operations on page B2-1273.
LoUIS, bits[23:21]
Level of Unification Inner Shareable for the cache hierarchy, see Terminology for Clean, Invalidate,
and Clean and Invalidate operations on page B2-1273.
In an implementation that does not include the Multiprocessing Extensions, this field is RAZ.
000 No cache
B4-1526 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
If software reads the Cache Type fields from Ctype1 upwards, once it has seen a value of 0b000, no
caches exist at further-out levels of the hierarchy. So, for example, if Ctype3 is the first Cache Type
field with a value of 0b000, the values of Ctype4 to Ctype7 must be ignored.
The CLIDR describes only the caches that are under the control of the processor.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1527
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The CNTFRQ register indicates the clock frequency of the system counter.
This register is a Generic Timer register.
Usage constraints In an implementation that includes the Security Extensions, RW only from Secure PL1
modes, RO from Non-secure PL1 and PL2 modes.
Otherwise, RW only from PL1 modes.
In all implementations, when CNTKCTL.{PL0VCTEN, PL0PCTEN} is not set to 0b00, is
also RO from PL0 modes.
Clock frequency
Note
Programming CNTFRQ does not affect the system clock frequency. However, on system initialization, CNTFRQ
must be correctly programmed with the system clock frequency, to make this value available to software. For more
information see Initializing and reading the system counter frequency on page B8-1947.
Accessing CNTFRQ
To access CNTFRQ, software reads or writes the CP15 registers with <opc1> set to 0, <CRn> set to c14, <CRm> set to
c0, and <opc2> set to 0. For example:
B4-1528 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Controls:
• Access to the following from Non-secure PL1 modes:
— The physical counter.
— The Non-secure PL1 physical timer.
• The generation of an event stream from the physical counter.
This register is a Generic Timer register.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Configurations Implemented only as part of the Generic Timers Extension, and only if the implementation
also includes the Virtualization Extensions.
This is a PL2-mode register, see Banked PL2-mode CP15 read/write registers on
page B3-1450.
Attributes A 32-bit RW register. See the field descriptions for information about the reset values.
Table B8-2 on page B8-1955 shows the encodings of all of the Generic Timer registers.
EVNTDIR
EVNTEN
PL1PCEN
PL1PCTEN
EVNTI, bits[7:4] Selects which bit of CNTPCT is the trigger for the event stream generated from the physical
counter, when that stream is enabled. For example, if this field is 0b0110, CNTPCT[6] is the
trigger bit for the virtual counter event stream.
For more information, see Event streams on page B8-1950.
This field is UNKNOWN on reset.
EVNTDIR, bit[3] Controls which transition of the CNTPCT trigger bit, defined by EVNTI, generates an
event, when the event stream is enabled:
0 A 0 to 1 transition of the trigger bit triggers an event.
1 A 1 to 0 transition of the trigger bit triggers an event.
For more information, see Event streams on page B8-1950.
This bit is UNKNOWN on reset.
EVNTEN, bit[2] Enables the generation of an event stream from the physical counter:
0 Disables the event stream.
1 Enables the event stream.
For more information, see Event streams on page B8-1950.
This bit resets to 0.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1529
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
PL1PCEN, bit[1] Controls whether the Non-secure copies of the physical timer registers are accessible from
Non-secure PL1 and PL0 modes:
0 The Non-secure CNTP_CVAL, CNTP_TVAL, and CNTP_CTL registers are
not accessible Non-secure PL1 and PL0 modes.
1 The Non-secure CNTP_CVAL, CNTP_TVAL, and CNTP_CTL registers are
accessible from Non-secure PL1 and PL0 modes.
For more information, see Accessing the timer registers on page B8-1952.
This bit resets to 1.
PL1PCTEN, bit[0] Controls whether the physical counter, CNTPCT, is accessible from Non-secure PL1 and
PL0 modes:
0 The CNTPCT register is not accessible from Non-secure PL1 and PL0 modes.
1 The CNTPCT register is accessible from Non-secure PL1 and PL0 modes.
For more information, see Accessing the physical counter on page B8-1948.
This bit resets to 1.
Accessing CNTHCTL
To access CNTHCTL, software reads or writes the CP15 registers with <opc1> set to 4, <CRn> set to c14, <CRm> set to
c1, and <opc2> set to 0. For example:
B4-1530 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The control register for the Hyp mode physical timer.
This register is a Generic Timer register.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
For more information, see Accessing the timer registers on page B8-1952.
Configurations Implemented only as part of the Generic Timers Extension, and only if the implementation
also includes the Virtualization Extensions.
This is a PL2-mode register, see Banked PL2-mode CP15 read/write registers on
page B3-1450.
Accessing CNTHP_CTL
To access CNTHP_CTL, software reads or writes the CP15 registers with <opc1> set to 4, <CRn> set to c14, <CRm> set
to c2, and <opc2> set to 1. For example:
Purpose Holds the compare value for the Hyp mode physical timer.
This register is a Generic Timer register.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
For more information, see Accessing the timer registers on page B8-1952.
Configurations Implemented only as part of the Generic Timers Extension, and only if the implementation
also includes the Virtualization Extensions.
This is a PL2-mode register, see Banked PL2-mode CP15 read/write registers on
page B3-1450.
Accessing CNTHP_CVAL
To access CNTHP_CVAL, software performs a 64-bit read or write of the CP15 registers with <CRm> set to c14 and
<opc1> set to 6. For example:
MRRC p15, 6, <Rt>, <Rt2>, c14 ; Read 64-bit CNTHP_CVAL into Rt (low word) and Rt2 (high word)
MCRR p15, 6, <Rt>, <Rt2>, c14 ; Write Rt (low word) and Rt2 (high word) to 64-bit CNTHP_CVAL
In these MRRC and MCRR instructions, Rt holds the least-significant word of CNTHP_CVAL, and Rt2 holds the
most-significant word.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1531
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Holds the timer value for the Hyp mode physical timer. This provides a 32-bit downcounter,
see Operation of the TimerValue views of the timers on page B8-1953.
This register is a Generic Timer register.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
For more information, see Accessing the timer registers on page B8-1952.
When CNTHP_CTL.ENABLE is set to 0:
• A write to this register updates the register.
• The value held in the register continues to decrement.
• A read of the register returns an UNKNOWN value.
Configurations Implemented only as part of the Generic Timers Extension, and only if the implementation
also includes the Virtualization Extensions.
This is a PL2-mode register, see Banked PL2-mode CP15 read/write registers on
page B3-1450.
Accessing CNTHP_TVAL
To access CNTHP_TVAL, software reads or writes the CP15 registers with <opc1> set to 4, <CRn> set to c14, <CRm>
set to c2, and <opc2> set to 0. For example:
B4-1532 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Controls:
• Access to the following from PL0 modes:
— The physical counter.
— The virtual counter.
— The PL1 physical timers.
— The virtual timer.
• The generation of an event stream from the virtual counter.
This register is a Generic Timer register.
Usage constraints Accessible from Secure PL1 modes, and Non-secure PL1 and PL2 modes.
Attributes A 32-bit RW register. See the field descriptions for information about the reset values.
Table B8-2 on page B8-1955 shows the encodings of all of the Generic Timer registers.
PL0PTEN EVNTDIR
PL0VTEN EVNTEN
PL0VCTEN
PL0PCTEN
PL0PTEN, bit[9] Controls whether the physical timer registers are accessible from PL0 modes:
0 The CNTP_CVAL, CNTP_CTL, and CNTP_TVAL registers are not accessible
from PL0.
1 The CNTP_CVAL, CNTP_CTL, and CNTP_TVAL registers are accessible
from PL0.
This bit resets to 0.
For more information, see Accessing the timer registers on page B8-1952.
PL0VTEN, bit[8] Controls whether the virtual timer registers are accessible from PL0 modes:
0 The CNTV_CVAL, CNTV_CTL, and CNTV_TVAL registers are not
accessible from PL0.
1 The CNTV_CVAL, CNTV_CTL, and CNTV_TVAL registers are accessible
from PL0.
This bit resets to 0.
For more information, see Accessing the timer registers on page B8-1952.
EVNTI, bits[7:4] Selects which bit of CNTVCT is the trigger for the event stream generated from the virtual
counter, when that stream is enabled. For example, if this field is 0b0110, CNTVCT[6] is the
trigger bit for the virtual counter event stream.
This field is UNKNOWN on reset.
For more information, see Event streams on page B8-1950.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1533
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
EVNTDIR, bit[3] Controls which transition of the CNTVCT trigger bit, defined by EVNTI, generates an
event, when the event stream is enabled:
0 A 0 to 1 transition of the trigger bit triggers an event.
1 A 1 to 0 transition of the trigger bit triggers an event.
This bit is UNKNOWN on reset.
For more information, see Event streams on page B8-1950.
EVNTEN, bit[2] Enables the generation of an event stream from the virtual counter:
0 Disables the event stream.
1 Enables the event stream.
This bit resets to 0.
For more information, see Event streams on page B8-1950.
PL0VCTEN, bit[1] Controls whether the virtual counter, CNTVCT, and the frequency register CNTFRQ, are
accessible from PL0 modes:
0 CNTVCT is not accessible from PL0.
If PL0PCTEN is set to 0, CNTFRQ is not accessible from PL0.
1 CNTVCT and CNTFRQ are accessible from PL0.
This bit resets to 0.
For more information, see Accessing the virtual counter on page B8-1949.
PL0PCTEN, bit[0] Controls whether the physical counter, CNTPCT, and the frequency register CNTFRQ, are
accessible from PL0 modes:
0 CNTPCT is not accessible from PL0 modes.
If PL0VCTEN is set to 0, CNTFRQ is not accessible from PL0.
1 CNTPCT and CNTFRQ are accessible from PL0.
This bit resets to 0.
For more information, see Accessing the physical counter on page B8-1948.
Note
CNTFRQ is accessible from PL0 modes if either PL0VCTEN or PL0PCTEN is set to 1.
Accessing CNTKCTL
To access CNTKCTL, software reads or writes the CP15 registers with <opc1> set to 0, <CRn> set to c14, <CRm> set to
c1, and <opc2> set to 0. For example:
B4-1534 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints In an implementation that does not include the Virtualization Extensions, accessible in PL1
modes.
In an implementation that includes the Virtualization Extensions:
• The Secure copy of the register is accessible in Secure PL1 modes.
• The Non-secure copy of the register is accessible in Non-secure Hyp mode, and when
CNTHCTL.PL1PCEN is set to 1, in Non-secure PL1 modes.
When the register is accessible in PL1 modes, in the current security state,
CNTKCTL.PL0PTEN determines whether the register is accessible from the PL0 mode.
For more information, see Accessing the timer registers on page B8-1952.
Reserved, UNK/SBZP
ISTATUS
IMASK
ENABLE
ISTATUS, bit[2] The status of the timer. This bit indicates whether the timer condition is asserted:
0 Timer condition is not asserted.
1 Timer condition is asserted.
When the ENABLE bit is set to 1, ISTATUS indicates whether the timer value meets the
condition for the timer output to be asserted, see Operation of the CompareValue views of
the timers on page B8-1952 and Operation of the TimerValue views of the timers on
page B8-1953. ISTATUS takes no account of the value of the IMASK bit. If ISTATUS is set
to 1 and IMASK is set to 0 then the timer output signal is asserted.
This bit is read-only.
IMASK, bit[1] Timer output signal mask bit. Permitted values are:
0 Timer output signal is not masked.
1 Timer output signal is masked.
For more information, see the description of the ISTATUS bit and Operation of the timer
output signal on page B8-1954.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1535
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Setting this bit to 0 disables the timer output signal, but the timer value accessible from
CNTP_TVAL continues to count down.
Note
Disabling the output signal might be a power-saving option.
Accessing CNTP_CTL
To access CNTP_CTL, software reads or writes the CP15 registers with <opc1> set to 0, <CRn> set to c14, <CRm> set
to c2, and <opc2> set to 1. For example:
B4-1536 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Holds the 64-bit compare value for the PL1 physical timer.
This register is a Generic Timer register.
Usage constraints In an implementation that does not include the Virtualization Extensions, accessible in PL1
modes.
In an implementation that includes the Virtualization Extensions:
• The Secure copy of the register is accessible in Secure PL1 modes.
• The Non-secure copy of the register is accessible in Non-secure Hyp mode, and when
CNTHCTL.PL1PCEN is set to 1, in Non-secure PL1 modes.
When the register is accessible in PL1 modes, in the current security state,
CNTKCTL.PL0PTEN determines whether the register is accessible from the PL0 mode.
For more information, see Accessing the timer registers on page B8-1952.
63 0
CompareValue[63:0]
CompareValue, bits[63:0]
Indicates the compare value for the PL1 physical timer.
For more information about the timer see Timers on page B8-1951.
Accessing CNTP_CVAL
To access CNTP_CVAL, software performs a 64-bit read or write of the CP15 registers with <CRm> set to c14 and
<opc1> set to 2. For example:
MRRC p15, 2, <Rt>, <Rt2>, c14 ; Read 64-bit CNTP_CVAL into Rt (low word) and Rt2 (high word)
MCRR p15, 2, <Rt>, <Rt2>, c14 ; Write Rt (low word) and Rt2 (high word) to 64-bit CNTP_CVAL
In these MRRC and MCRR instructions, Rt holds the least-significant word of CNTP_CVAL, and Rt2 holds the
most-significant word.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1537
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Holds the timer value for the PL1 physical timer. This provides a 32-bit downcounter, see
Operation of the TimerValue views of the timers on page B8-1953.
This register is a Generic Timer register.
Usage constraints In an implementation that does not include the Virtualization Extensions, accessible in PL1
modes.
In an implementation that includes the Virtualization Extensions:
• The Secure copy of the register is accessible in Secure PL1 modes.
• The Non-secure copy of the register is accessible in Non-secure Hyp mode, and when
CNTHCTL.PL1PCEN is set to 1, in Non-secure PL1 modes.
When the register is accessible in PL1 modes, in the current security state,
CNTKCTL.PL0PTEN determines whether the register is accessible from the PL0 mode.
For more information, see Accessing the timer registers on page B8-1952.
When CNTP_CTL.ENABLE is set to 0:
• A write to this register updates the register.
• The value held in the register continues to decrement.
• A read of the register returns an UNKNOWN value.
TimerValue
TimerValue, bits[31:0]
Indicates the timer value.
Accessing CNTP_TVAL
To access CNTP_TVAL, software reads or writes the CP15 registers with <opc1> set to 0, <CRn> set to c14, <CRm> set
to c2, and <opc2> set to 0. For example:
B4-1538 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The CNTPCT register holds the 64-bit physical count value.
This register is a Generic Timer register.
Usage constraints In an implementation that does not include the Virtualization Extensions, always accessible
from PL1 modes, in both security states.
In an implementation that includes the Virtualization Extensions, CNTPCT is:
• Always accessible Secure PL1 modes and from Non-secure Hyp mode.
• Accessible from Non-secure PL1 modes only when CNTHCTL.PL1PCTEN is set
to 1.
When CNTKCTL.PL0PCTEN is set to 1, CNTPCT is also accessible from PL0 modes.
Fore more information about the CNTPCT access controls see Accessing the physical
counter on page B8-1948.
63 0
PhysicalCount[63:0]
PhysicalCount, bits[63:0]
Indicates the physical count.
Accessing CNTPCT
To access CNTPCT, software performs a 64-bit read of the CP15 registers with <CRm> set to c14 and <opc1> set to 0.
For example:
MRRC p15, 0, <Rt>, <Rt2>, c14 ; Read 64-bit CNTPCT into Rt (low word) and Rt2 (high word)
In the MRRC instruction, Rt holds the least-significant word of CNTPCT, and Rt2 holds the most-significant word.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1539
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints Accessible from Secure PL1 modes and Non-secure PL1 and PL2 modes. When
CNTKCTL.PL0VTEN is set to 1, also accessible from PL0 modes.
For more information, see Accessing the timer registers on page B8-1952.
The bit assignments of the CNTV_CTL register are identical to those of CNTP_CTL.
Accessing CNTV_CTL
To access CNTV_CTL, software reads or writes the CP15 registers with <opc1> set to 0, <CRn> set to c14, <CRm> set
to c3, and <opc2> set to 1. For example:
Usage constraints Accessible from Secure PL1 modes and Non-secure PL1 and PL2 modes. When
CNTKCTL.PL0VTEN is set to 1, also accessible from PL0 modes.
For more information, see Accessing the timer registers on page B8-1952.
Accessing CNTV_CVAL
To access CNTV_CVAL, software performs a 64-bit read or write of the CP15 registers with <CRm> set to c14 and
<opc1> set to 3. For example:
MRRC p15, 3, <Rt>, <Rt2>, c14 ; Read 64-bit CNTV_CVAL into Rt (low word) and Rt2 (high word)
MCRR p15, 3, <Rt>, <Rt2>, c14 ; Write 64-bit Rt (low word) and Rt2 (high word) to CNTV_CVAL
In these MRRC and MCRR instructions, Rt holds the least-significant word of CNTV_CVAL, and Rt2 holds the
most-significant word.
B4-1540 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Holds the timer value for the virtual timer. This provides a 32-bit downcounter, see
Operation of the TimerValue views of the timers on page B8-1953.
This register is a Generic Timer register.
Usage constraints Accessible from Secure PL1 modes and Non-secure PL1 and PL2 modes. When
CNTKCTL.PL0VTEN is set to 1, also accessible from PL0 modes.
For more information, see Accessing the timer registers on page B8-1952.
When CNTV_CTL.ENABLE is set to 0:
• A write to this register updates the register.
• The value held in the register continues to decrement.
• A read of the register returns an UNKNOWN value.
Accessing CNTV_TVAL
To access CNTV_TVAL, software reads or writes the CP15 registers with <opc1> set to 0, <CRn> set to c14, <CRm> set
to c3, and <opc2> set to 0. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1541
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
The virtual count is obtained by subtracting the virtual offset from the physical count, see
The virtual counter on page B8-1949.
Usage constraints Always accessible from Secure PL1 modes and Non-secure PL1 and PL2 modes.
When CNTKCTL.PL0VCTEN is set to 1, is also accessible from Secure and Non-secure
PL0 modes. For more information about the CNTVCT access controls see Accessing the
virtual counter on page B8-1949.
63 0
VirtualCount[63:0]
VirtualCount, bits[63:0]
Indicates the virtual count.
Accessing CNTVCT
To access CNTVCT, software performs a 64-bit read of the CP15 registers with <CRm> set to c14 and <opc1> set to
1. For example:
MRRC p15, 1, <Rt>, <Rt2>, c14 ; Read 64-bit CNTVCT into Rt (low word) and Rt2 (high word)
In the MRRC instruction, Rt holds the least-significant word of CNTVCT, and Rt2 holds the most-significant word.
B4-1542 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes If the Virtualization Extensions are implemented, this is a 64-bit RW register with an
UNKNOWN reset value. If the Virtualization Extensions are not implemented, for all purposes
other than direct reads and writes this register behaves as if it contains the value 0.
Table B8-2 on page B8-1955 shows the encodings of all of the Generic Timer registers.
In an ARMv7 implementation that also includes the Virtualization Extensions, the CNTVOFF bit assignments are:
63 0
VirtualOffset[63:0]
VirtualOffset, bits[63:0]
Indicates the virtual offset.
Accessing CNTVOFF
To access CNTVOFF, software performs a 64-bit read or write of the CP15 registers with <CRm> set to c14 and <opc1>
set to 4. For example:
MRRC p15, 4, <Rt>, <Rt2>, c14 ; Read 64-bit CNTVOFF into Rt (low word) and Rt2 (high word)
MCRR p15, 4, <Rt>, <Rt2>, c14 ; Write Rt (low word) and Rt2 (high word) to 64-bit CNTVOFF
In these MRRC and MCRR instructions, Rt holds the least-significant word of CNTVOFF, and Rt2 holds the
most-significant word.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1543
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose CONTEXTIDR identifies the current Process Identifier (PROCID) and, when using the
Short-descriptor translation table format, the Address Space Identifier (ASID).
This register is part of the Virtual memory control registers functional group.
Configurations The register format depends on whether address translation is using the Long-descriptor or
the Short-descriptor translation table format.
In an implementation that includes the Security Extensions, this register is Banked.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-45 on page B3-1488 shows the encodings of all of the registers in the Virtual
memory control registers functional group.
31 8 7 0
Short-descriptor† PROCID ASID
Long-descriptor† PROCID
Note
When using the Long-descriptor translation table format, either TTBR0 or TTBR1 holds the current
ASID.
• The debug logic, for Linked and Unlinked Context ID matching, see Breakpoint debug events on
page C3-2027 and Watchpoint debug events on page C3-2045.
The ASID field value is an identifier for a particular process. In the translation tables it identifies entries associated
with a process, and distinguishes them from global entries. This means many cache and TLB maintenance
operations take an ASID argument.
For information about the synchronization of changes to the CONTEXTIDR see Synchronization of changes to
system control registers on page B3-1457. There are particular synchronization requirements when changing the
ASID and Translation Table Base Registers, see Synchronization of changes of ASID and TTBR on page B3-1382.
B4-1544 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1545
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4-1546 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
In an implementation that includes the Virtualization Extensions, accesses to coprocessors
other than CP14 and CP15, and to floating-point and Advanced SIMD functionality, from
Hyp mode, are controlled by settings in the NSACR and HCPTR. The NSACR settings take
precedence over the HCPTR settings.
Configurations If the implementation includes the Security Extensions, this is a Configurable access
register, see Configurable access system control registers on page B3-1449. Bits in the
NSACR control Non-secure access to the CPACR fields. See the field descriptions for more
information.
Attributes A 32-bit RW register. See the field descriptions for the reset values. See also Reset behavior
of CP14 and CP15 registers on page B3-1446.
Table B3-47 on page B3-1489 shows the encodings of all of the registers in the Other
system control registers functional group.
(0) cp13 cp12 cp11 cp10 cp9 cp8 cp7 cp6 cp5 cp4 cp3 cp2 cp1 cp0
TRCDIS
D32DIS
ASEDIS
ASEDIS, bit[31]
Disable Advanced SIMD functionality:
0 This bit does not cause any instructions to be UNDEFINED.
1 All instruction encodings identified in the Alphabetical list of instructions on
page A8-298 as being Advanced SIMD instructions, but that are not VFPv3 or VFPv4
instructions, are UNDEFINED when accessed from PL1 and PL0 modes.
Note
On an implementation that includes the Virtualization Extensions, when the HCPTR.TASE bit is set
to 1, any use of these instructions from a Non-secure PL1 or PL0 mode, that is not UNDEFINED, is
trapped to Hyp mode.
On an implementation that:
• Implements the Floating-point Extension and does not implement the Advanced SIMD
Extension, this bit is RAO/WI.
• Does not implement the Floating-point Extension or the Advanced SIMD Extension, this bit
is UNK/SBZP.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1547
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
• Implements both the Floating-point Extension and the Advanced SIMD Extension, it is
IMPLEMENTATION DEFINED whether this bit is supported. If it is not supported it is RAZ/WI.
D32DIS, bit[30]
Disable use of D16-D31 of the Floating-point Extension register file:
0 This bit does not cause any instructions to be UNDEFINED.
1 All instruction encodings identified in the Alphabetical list of instructions on
page A8-298 as being VFPv3 or VFPv4 instructions are UNDEFINED if they access any
of registers D16-D31 when executed from a PL1 or PL0 mode.
If this bit is 1 when CPACR.ASEDIS == 0, the result is UNPREDICTABLE.
On an implementation that:
• Does not implement the Floating-point Extension, this bit is UNK/SBZP.
• Implements the Floating-point Extension and does not implement D16-D31, this bit is
RAO/WI.
• Implements the Floating-point Extension and implements D16-D31, it is IMPLEMENTATION
DEFINED whether this bit is supported. If it is not supported it is RAZ/WI.
TRCDIS, bit[28]
Disable CP14 access to trace registers:
0 This bit does not cause any instructions to be UNDEFINED.
1 Any MRC or MCR instruction with coproc set to 0b1110 and opc1 set to 0b001 is UNDEFINED
when executed from a PL1 or PL0 mode.
Note
On an implementation that includes the Virtualization Extensions, when the HCPTR.TTA bit is set
to 1, any use of these instructions from a Non-secure PL1 or PL0 mode, that is not UNDEFINED, is
trapped to Hyp mode.
On an implementation that:
• Does not include a trace macrocell, or does not include a CP14 interface to the trace
macrocell registers, this bit is RAZ/WI.
• Includes a CP14 interface to trace macrocell registers, it is IMPLEMENTATION DEFINED
whether this bit is supported. If it is not supported it is RAZ/WI.
If this bit is implemented as an RW bit:
• Its reset value is UNKNOWN.
• When NSACR.NSTRCDIS is set to 1, it behaves as RAO/WI when accessed from
Non-secure state.
B4-1548 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
On an implementation that includes the Virtualization Extensions:
• The Full access setting for a cpn field, 0b11, cannot permit any accesses from PL2.
• When the corresponding HCPTR.TCPn bit is set to 1, any access to the coprocessor from a
Non-secure PL1 or PL0 mode, that is not UNDEFINED, is trapped to Hyp mode.
For a coprocessor that is not implemented this field is RAZ/WI. Coprocessors 8, 9, 12, and 13 are
reserved for future use by ARM, and therefore cp8, cp9, cp12, and cp13 are RAZ/WI.
If CPACR.cpn is implemented as RW, when NSACR.cpn is set to 0, CPACR.cpn behaves as
RAZ/WI when accessed from Non-secure state.
When implemented as an RW field, cpn resets to zero.
In an implementation that includes the Security Extensions, the NSACR controls whether each coprocessor can be
accessed from the Non-secure state. When the NSACR permits Non-secure access to a coprocessor, the CPACR
determines the level of access permitted. Because the CPACR is not Banked, the options for Non-secure state access
to a coprocessor are:
• No access.
• Identical access rights to the Secure state.
If more than one coprocessor is required to provide a particular set of functionality, then having different values for
the CPACR fields for those coprocessors can lead to UNPREDICTABLE behavior. An example where this must be
considered is with the Floating-point Extension. This uses CP10 and CP11.
In addition, in an implementation that includes the Security Extensions, the implementation of the
NSACR{NSTRCDIS, NSASEDIS, NSD32DIS} bits must correspond to the implementation of the
CPACR{TRCDIS, ASEDIS, D32DIS} bit, and implemented NSACR bits control Non-secure access to the
associated functionality. For more information see the NSACR bit descriptions.
Typically, an operating system uses this register to control coprocessor resource sharing among applications:
• Initially all applications are denied access to the shared coprocessor-based resources.
• The Undefined Instruction exception handler can then grant access to the resource by setting the appropriate
field in the CPACR.
Sharing resources among applications requires a state saving mechanism. Two possibilities are:
• During a context switch, if the last executing process or thread had access rights to a coprocessor then the
operating system saves the state of that coprocessor.
• On receiving a request for access to a coprocessor, the operating system saves the old state for that
coprocessor with the last process or thread that accessed it.
For details of how software can use this register to check for implemented coprocessors see Access controls on CP0
to CP13 on page B1-1226.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1549
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Normally, software uses a read, modify, write sequence to update the CPACR, to avoid unwanted changes to the
access settings for other coprocessors.
B4-1550 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
InD
Level, bits[3:1]
Cache level of required cache. Permitted values are from 0b000, indicating Level 1 cache, to 0b110
indicating Level 7 cache.
If this field is set to an unimplemented level of cache, the effect is UNPREDICTABLE.
See the Note in Access to registers from Monitor mode on page B3-1455 for a description of how SCR.NS controls
whether Monitor mode accesses are to the Secure or Non-secure copy of the selected CCSIDR.
Accessing CSSELR
To access CSSELR, software reads or writes the CP15 registers with <opc1> set to 2, <CRn> set to c0, <CRm> set to c0,
and <opc2> set to 0. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1551
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The CTR provides information about the architecture of the caches.
This register is part of the Identification registers functional group.
Configurations If the implementation includes the Security Extensions, this register is Common.
ARMv7 changes the format of the CTR, This section describes only the ARMv7 format. For
more information see the description of the Format field, bits[31:29].
Attributes A 32-bit RO register with an IMPLEMENTATION DEFINED value. See also Reset behavior of
CP14 and CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
Format
Format, bits[31:29]
Indicates the implemented CTR format. The possible values of this are:
0b000 ARMv6 format, see CP15 c0, Cache Type Register, CTR, ARMv4 and ARMv5 on
page D15-2601.
0b100 ARMv7 format. This is the format described in this section.
Bit[28] RAZ.
CWG, bits[27:24]
Cache Write-back Granule. The maximum size of memory that can be overwritten as a result of the
eviction of a cache entry that has had a memory location in it modified, encoded as Log2 of the
number of words.
A value of 0b0000 indicates that the CTR does not provide Cache Write-back Granule information
and either:
• The architectural maximum of 512 words (2Kbytes) must be assumed.
• The Cache Write-back Granule can be determined from maximum cache line size encoded in
the Cache Size ID Registers.
Values greater than 0b1001 are reserved.
ERG, bits[23:20]
Exclusives Reservation Granule. The maximum size of the reservation granule that has been
implemented for the Load-Exclusive and Store-Exclusive instructions, encoded as Log2 of the
number of words. For more information, see Tagging and the size of the tagged memory block on
page A3-119.
A value of 0b0000 indicates that the CTR does not provide Exclusives Reservation Granule
information and the architectural maximum of 512 words (2Kbytes) must be assumed.
Values greater than 0b1001 are reserved.
DminLine, bits[19:16]
Log2 of the number of words in the smallest cache line of all the data caches and unified caches that
are controlled by the processor.
B4-1552 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
L1Ip, bits[15:14]
Level 1 instruction cache policy. Indicates the indexing and tagging policy for the L1 instruction
cache. Table B4-3 shows the possible values for this field.
00 Reserved
Bits[13:4] RAZ.
IminLine, bits[3:0]
Log2 of the number of words in the smallest cache line of all the instruction caches that are
controlled by the processor.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1553
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose DACR defines the access permission for each of the sixteen memory domains.
This register is part of the Virtual memory control registers functional group.
Attributes A 32-bit RW register with an UNKNOWN reset value. For more information see Reset
behavior of CP14 and CP15 registers on page B3-1446.
Table B3-45 on page B3-1488 shows the encodings of all of the registers in the Virtual
memory control registers functional group.
Dn, bits[(2n+1):2n]
Domain n access permission, where n = 0 to 15. Permitted values are:
0b00 No access. Any access to the domain generates a Domain fault.
0b01 Client. Accesses are checked against the permission bits in the translation tables.
0b10 Reserved, effect is UNPREDICTABLE.
0b11 Manager. Accesses are not checked against the permission bits in the translation tables.
For more information, see Domains, Short-descriptor format only on page B3-1358.
B4-1554 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.44 DCCIMVAC, Data Cache Clean and Invalidate by MVA to PoC, VMSA
Cache and branch predictor maintenance operations, VMSA on page B4-1735 describes this cache maintenance
operation.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1555
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The DFAR holds the VA of the faulting address that caused a synchronous Data Abort
exception.
This register is part of the PL1 Fault handling registers functional group.
Configurations If the implementation includes the Security Extensions, this register is Banked.
Before ARMv7 the DFAR was called the Fault Address Register (FAR).
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-46 on page B3-1489 shows the encodings of all of the registers in the PL1 Fault
handling registers functional group.
For information about using the DFAR, and when the value in the DFAR is valid, see Exception reporting in a VMSA
implementation on page B3-1406.
B4-1556 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The DFSR holds status information about the last data fault.
This register is part of the PL1 Fault handling registers functional group.
Configurations The Large Physical Address Extension adds an alternative format for the register. If an
implementation includes the Large Physical Address Extension then the current translation
table format determines which format of the register is used.
If the implementation includes the Security Extensions, this register is Banked.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-46 on page B3-1489 shows the encodings of all of the registers in the PL1 Fault
handling registers functional group.
For information about using the DFSR see Exception reporting in a VMSA implementation on page B3-1406.
Note
In an implementation that includes the Large Physical Address Extension, TTBCR.EAE resets to 0 in both the
Secure and the Non-secure copies of the register.
CM†
ExT
WnR
FS[4]
LPAE†
† Only on an implementation that includes the Large Physical Address Extension.
For more information, see the field description.
* Returned value, but might be overwritten, because the bit is RW.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1557
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Bit[13], if implementation does not include the Large Physical Address Extension
Reserved, UNK/SBZP.
ExT, bit[12] External abort type. This bit can provide an IMPLEMENTATION DEFINED classification of external
aborts.
For aborts other than external aborts this bit always returns 0.
In an implementation that does not provide any classification of external aborts, this bit is
UNK/SBZP.
WnR, bit[11] Write not Read bit. On a synchronous exception, indicates whether the abort was caused by a write
instruction or by a read instruction. The possible values of this bit are:
0 Abort caused by a read instruction.
1 Abort caused by a write instruction.
For synchronous faults on CP15 cache maintenance operations, including the address translation
operations, this bit always returns a value of 1.
This bit is UNKNOWN on:
• An asynchronous Data Abort exception.
• A Data Abort exception caused by a debug exception.
LPAE, bit[9], if the implementation includes the Large Physical Address Extension
On taking a Data Abort exception, this bit is set to 0 to indicate use of the Short-descriptor
translation table formats.
Hardware does not interpret this bit to determine the behavior of the memory system, and therefore
software can set this bit to 0 or 1 without affecting operation. Unless the register has been updated
to report a fault, a subsequent read of the register returns the value written to it.
Bit[9], if the implementation does not include the Large Physical Address Extension
Reserved, UNK/SBZP.
Domain, bits[7:4]
The domain of the fault address.
ARM deprecates any use of this field, see The Domain field in the DFSR on page B3-1412.
This field is UNKNOWN on a Data Abort exception:
• Caused by a debug exception.
• Caused by a Permission fault in an implementation includes the Large Physical Address
Extension.
B4-1558 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
CM
ExT
WnR
LPAE
* Returned value, but might be overwritten, because the bit is RW.
CM, bit[13] Cache maintenance fault. For synchronous faults, this bit indicates whether a cache maintenance
operation generated the fault. The possible values of this bit are:
0 Abort not caused by a cache maintenance operation.
1 Abort caused by a cache maintenance operation.
On an asynchronous fault, this bit is UNKNOWN.
ExT, bit[12] External abort type. This bit can provide an IMPLEMENTATION DEFINED classification of external
aborts.
For aborts other than external aborts this bit always returns 0.
In an implementation that does not provide any classification of external aborts, this bit is
UNK/SBZP.
WnR, bit[11] Write not Read bit. On a synchronous exception, indicates whether the abort was caused by a write
instruction or by a read instruction. The possible values of this bit are:
0 Abort caused by a read instruction.
1 Abort caused by a write instruction.
For synchronous faults on CP15 cache maintenance operations, including the address translation
operations, this bit always returns a value of 1.
This bit is UNKNOWN on:
• An asynchronous Data Abort exception.
• A Data Abort exception caused by a debug exception.
LPAE, bit[9] On taking a Data Abort exception, this bit is set to 1 to indicate use of the Long-descriptor
translation table formats.
Hardware does not interpret this bit to determine the behavior of the memory system, and therefore
software can set this bit to 0 or 1 without affecting operation. Unless the register has been updated
to report a fault, a subsequent read of the register returns the value written to it.
STATUS, bits[5:0]
Fault status bits. For the valid encodings of these bits when using the Long-descriptor translation
table format, see Table B3-24 on page B3-1413. All encodings not shown in the table are reserved.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1559
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4-1560 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
This operation is part of the TLB maintenance operations functional group. Table B3-50 on page B3-1492 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the TLB maintenance operations functional group. Table B3-50 on page B3-1492 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the TLB maintenance operations functional group. Table B3-50 on page B3-1492 shows
the encodings of all of the registers and operations in this functional group.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1561
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The FCSEIDR identifies the current Process ID (PID) for the Fast Context Switch Extension
(FCSE).
This register is part of the Other system control registers functional group.
In an implementation that includes the FCSE, the FCSEIDR bit assignments are:
31 25 24 0
PID, bits[31:25]
The current Process ID, for the FCSE. If the FCSE is not implemented this field is RAZ/WI.
Bits[24:0] Reserved:
• In an implementation that includes the FCSE, this field is UNK/SBZP.
• If the FCSE is not implemented this field is RAZ/WI.
In ARMv7, the FCSE is OPTIONAL and deprecated, but the FCSEIDR must be implemented regardless of whether
the implementation includes the FCSE. Software can access this register to determine whether the implementation
includes the FCSE.
Note
• Changing the PID changes the overall virtual-to-physical address mapping. Because of this, software must
ensure that instructions that might have been speculatively fetched are not affected by the address mapping
change.
• From ARMv6, ARM deprecates any use of the FCSE. The FCSE is:
— OPTIONAL and deprecated in an ARMv7 implementation that does not include the Multiprocessing
Extensions.
— Obsolete from the addition of the Multiprocessing Extensions.
B4-1562 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1563
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Provides a global enable for the Advanced SIMD and Floating-point (VFP) Extensions, and
indicates how the state of these extensions is recorded.
Usage constraints Only accessible by software executing at PL1 or higher. See Enabling Advanced SIMD and
floating-point support on page B1-1228 for more information.
Attributes A 32-bit RW register. See the register field descriptions for information about the reset
value.
Table B1-24 on page B1-1235 shows the encodings of all of the Advanced SIMD and
Floating-point Extension system registers.
SUBARCHITECTURE DEFINED
EX
EN
EX, bit[31] Exception bit. A status bit that specifies how much information must be saved to record the state of
the Advanced SIMD and Floating-point system:
0 The only significant state is the contents of the registers:
• D0 - D15.
• D16 - D31, if implemented.
• FPSCR.
• FPEXC.
A context switch can be performed by saving and restoring the values of these registers.
1 There is additional state that must be handled by any context switch system.
The reset value of this bit is UNKNOWN.
The behavior of the EX bit on writes is SUBARCHITECTURE DEFINED, except that in any
implementation a write of 0 to this bit must be a valid operation, and must return a value of 0 if read
back before any subsequent write to the register.
EN, bit[30] Enable bit. A global enable for the Advanced SIMD and Floating-point Extensions:
0 The Advanced SIMD and Floating-point Extensions are disabled. For details of how the
system operates when EN == 0 see Enabling Advanced SIMD and floating-point
support on page B1-1228.
1 The Advanced SIMD and Floating-point Extensions are enabled and operate normally.
B4-1564 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Bits[29:0] SUBARCHITECTURE DEFINED. An implementation can use these bits to communicate exception
information between the floating-point hardware and the support code. The subarchitectural
definition of these bits includes their read/write access. This can be defined on a bit by bit basis. This
means that the reset value of these bits is SUBARCHITECTURE DEFINED.
A constraint on these bits is that if EX == 0 it must be possible to save and restore all significant
state for the floating-point system by saving and restoring only the two Advanced SIMD and
Floating-point Extension registers FPSCR and FPEXC.
Writes to the FPEXC can have side-effects on various aspects of processor operation. All of these side-effects are
synchronous to the FPEXC write. This means they are guaranteed not to be visible to earlier instructions in the
execution stream, and they are guaranteed to be visible to later instructions in the execution stream.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1565
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints There are no usage constraints, but see Enabling Advanced SIMD and floating-point
support on page B1-1228 for information about enabling access to this register.
Attributes A 32-bit RW register. The reset value of the register fields are UNKNOWN except where the
field descriptions indicate otherwise.
Table B1-24 on page B1-1235 shows the encodings of all of the Advanced SIMD and
Floating-point Extension system registers.
QC IDE IOC
AHP Reserved DZC
DN IXE OFC
FZ UFE UFC
RMode OFE IXC
Stride DZE Reserved
Reserved IOE IDC
See the field descriptions for implementation differences in different VFP versions
Bits[31:28] Condition flags. These are updated by floating-point comparison operations, as shown in Effect of
a Floating-point comparison on the condition flags on page A2-79.
N, bit[31] Negative condition flag.
Z, bit[30] Zero condition flag.
C, bit[29] Carry condition flag.
V, bit[28] Overflow condition flag.
Note
Advanced SIMD operations never update these bits.
QC, bit[27] Cumulative saturation bit, Advanced SIMD only. This bit is set to 1 to indicate that an Advanced
SIMD integer operation has saturated since 0 was last written to this bit. For details of saturation,
see Pseudocode details of saturation on page A2-44.
If the implementation does not include the Advanced SIMD Extension, this bit is UNK/SBZP.
B4-1566 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
RMode, bits[23:22]
Rounding Mode control field. The encoding of this field is:
0b00 Round to Nearest (RN) mode.
0b01 Round towards Plus Infinity (RP) mode.
0b10 Round towards Minus Infinity (RM) mode.
0b11 Round towards Zero (RZ) mode.
The specified rounding mode is used by almost all floating-point instructions that are part of the
Floating-point Extension. Advanced SIMD arithmetic always uses the Round to Nearest setting,
regardless of the value of the RMode bits.
Note
The rounding mode names are based on the IEEE 754-1985 terminology. See Floating-point
standards, and terminology on page A2-55 for the corresponding terms in the IEEE 754-2008
revision of the standard.
Bits[15, 12:8] Floating-point exception trap enable bits. These bits are supported only in VFPv2, VFPv3U, and
VFPv4U. They are reserved, RAZ/WI, on a system that implements VFPv3 or VFPv4.
The possible values of each bit are:
0 Untrapped exception handling selected. If the floating-point exception occurs then the
corresponding cumulative exception bit is set to 1.
1 Trapped exception handling selected. If the floating-point exception occurs, hardware
does not update the corresponding cumulative exception bit. The trap-handling software
can decide whether to set the cumulative exception bit to 1.
The values of these bits control only Floating-point arithmetic. Advanced SIMD arithmetic always
uses untrapped exception handling, regardless of the values of these bits.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1567
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Bits[7, 4:0] Cumulative exception bits for floating-point exceptions. Each of these bits is set to 1 to indicate that
the corresponding exception has occurred since 0 was last written to it. How floating-point
instructions update these bits depends on the value of the corresponding exception trap enable bits,
see the description of bits[15, 12:8].
Advanced SIMD instructions set each cumulative exception bit if the corresponding exception
occurs in one or more of the floating-point calculations performed by the instruction, regardless of
the setting of the trap enable bits.
For more information, see Floating-point exceptions on page A2-69.
IDC, bit[7] Input Denormal cumulative exception bit. Updated by hardware only when
IDE, bit[15], is set to 0.
IXC, bit[4] Inexact cumulative exception bit. Updated by hardware only when IXE,
bit[12], is set to 0.
UFC, bit[3] Underflow cumulative exception bit. Updated by hardware only when UFE,
bit[11], is set to 0.
OFC, bit[2] Overflow cumulative exception bit. Updated by hardware only when OFE,
bit[10], is set to 0.
DZC, bit[1] Division by Zero cumulative exception bit. Updated by hardware only when
DZE, bit[9], is set to 0.
IOC, bit[0] Invalid Operation cumulative exception bit. Updated by hardware only
when IOE, bit[8], is set to 0.
If the implementation includes the integer-only Advanced SIMD Extension and does not include the Floating-point
Extension, all of these bits except QC are UNK/SBZP.
Writes to the FPSCR can have side-effects on various aspects of processor operation. All of these side-effects are
synchronous to the FPSCR write. This means they are guaranteed not to be visible to earlier instructions in the
execution stream, and they are guaranteed to be visible to later instructions in the execution stream.
B4-1568 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints Only accessible from PL1 or higher. See Enabling Advanced SIMD and floating-point
support on page B1-1228 for more information.
This register complements the information provided by the CPUID scheme described in
Chapter B7 The CPUID Identification Scheme.
Configurations FPSID can be implemented in a system that provides only software emulation of the ARM
floating-point instructions, and must be implemented if the implementation includes one or
both of:
• The Floating-point Extension.
• The Advanced SIMD Extension.
The VMSA and PMSA definitions of the register fields are identical.
In an implementation that includes the Security Extensions, FPSID is a Configurable access
register. When the settings in the CPACR permit access to the register:
• It is accessible in Non-secure state only if the NSACR.{CP11, CP10} bits are both
set to 1.
• If the implementation also includes the Virtualization Extensions then bits in the
HCPTR also control Non-secure access to the register.
For more information, see Access controls on CP0 to CP13 on page B1-1226.
Note
Although the FPSID is a RO register, a write using the FPSID encoding is a valid serializing
operation, see Asynchronous bounces, serialization, and Floating-point exception barriers
on page B1-1237. Such a write does not access the register.
Table B1-24 on page B1-1235 shows the encodings of all of the Advanced SIMD and
Floating-point Extension system registers.
SW
Implementer, bits[31:24]
Implementer codes are the same as those used for the MIDR.
For an implementation by ARM this field is 0x41, the ASCII code for A.
SW, bit[23] Software bit. This bit indicates whether a system provides only software emulation of the
floating-point instructions that are provided by the Floating-point Extension:
0 The system includes hardware support for the floating-point instructions provided by
the Floating-point Extension.
1 The system provides only software emulation of the floating-point instructions provided
by the Floating-point Extension.
Subarchitecture, bits[22:16]
Subarchitecture version number. For an implementation by ARM, permitted values are:
0b0000000 VFPv1 architecture with an IMPLEMENTATION DEFINED subarchitecture.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1569
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Variant, bits[7:4]
An IMPLEMENTATION DEFINED variant number. Typically, this field distinguishes between different
production variants of a single product.
Revision, bits[3:0]
An IMPLEMENTATION DEFINED revision number for the floating-point implementation.
B4-1570 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HACR controls the trapping to Hyp mode of IMPLEMENTATION DEFINED aspects of
Non-secure PL1 or PL0 operation.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register with an IMPLEMENTATION DEFINED reset value. See also Reset
behavior of CP14 and CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
The HACR bit assignments are IMPLEMENTATION DEFINED.
Purpose The HACTLR controls IMPLEMENTATION DEFINED features of Hyp mode operation.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register with an IMPLEMENTATION DEFINED reset value. See also Reset
behavior of CP14 and CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1571
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.62 HADFSR and HAIFSR, Hyp Auxiliary Fault Syndrome Registers, Virtualization Extensions
The Hyp Auxiliary Data Fault Syndrome Register, HADFSR, and Hyp Auxiliary Instruction Fault Syndrome
Register, HAIFSR, characteristics are:
Purpose The HAxFSR contain additional IMPLEMENTATION DEFINED syndrome information for:
• Data Abort exceptions taken to Hyp mode, for the HADFSR.
• Prefetch Abort exceptions taken to Hyp mode, for the HAIFSR.
These registers are part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Configurations Implemented only as part of the Virtualization Extensions. These are optional registers. An
implementation that does not require one or both of these registers can implement the
registers that are not required as UNK/SBZP.
These are Banked PL2-mode register, see Banked PL2-mode CP15 read/write registers on
page B3-1450.
Attributes 32-bit RW registers with UNKNOWN reset values. See also Reset behavior of CP14 and CP15
registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
B4-1572 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.63 HAMAIR0 and HAMAIR1, Hyp Auxiliary Memory Attribute Indirection Registers 0 and 1
The HAMAIR0 and HAMAIR1 characteristics are
Purpose The HAMAIR0 and HAMAIR1 registers provide IMPLEMENTATION DEFINED memory
attributes for the memory attribute encodings defined by the HMAIR0 and HMAIR1
registers.
These IMPLEMENTATION DEFINED attributes can only provide additional qualifiers for the
memory attribute encodings, and cannot change the memory attributes defined in the
HMAIR0 and HMAIR1 registers.
These registers are part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
If an implementation does not provide any IMPLEMENTATION DEFINED memory attributes
these registers are UNK/SBZP.
Attributes 32-bit RW registers with an UNKNOWN reset values. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
Note
Although all aspects of the HAMAIRn register bit assignments are IMPLEMENTATION DEFINED, a likely usage model
is that the two HAMAIRn registers provide eight 8-bit fields, indexed by the AttrIndx[2:0] value from the
translation table descriptor, as described for the HMAIR registers.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1573
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HCPTR controls the trapping to Hyp mode of Non-secure accesses, at PL1 or lower, to
coprocessors other than CP14 and CP15, and to floating-point and Advanced SIMD
functionality. It also controls the access to coprocessors other than CP14 and CP15, and to
floating-point and Advanced SIMD functionality, from Hyp mode.
Note
Accesses to coprocessors other than CP14 and CP15, and to floating-point and Advanced
SIMD functionality, from Hyp mode:
• Are not affected by settings in the CPACR.
• Are affected by settings in the NSACR, and the NSACR settings take precedence
over the HCPTR settings. See the Usage Constraints for more information.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
If a bit in the NSACR prohibits a Non-secure access, then the corresponding bit in the
HCPTR behaves as RAO/WI for Non-secure accesses. See the bit descriptions for more
information.
Attributes A 32-bit RW register that resets to zero. See also Reset behavior of CP14 and CP15 registers
on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
31 30 21 20 19 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Reserved,
Reserved, UNK/SBZP (0)
UNK/SBZP
In the descriptions of the HCPTR fields, an otherwise-valid Non-secure access means an access that, if the bit was
set to 0, would not be UNDEFINED or UNPREDICTABLE.
For more information about all of these bits see Trapping accesses to coprocessors on page B1-1255.
For more information about control of access to functionality provided by the Advanced SIMD and Floating-point
Extensions, see Enabling Advanced SIMD and floating-point support on page B1-1228.
TCPAC, bit[31]
Trap CPACR accesses. The possible values of this bit are:
0 Has no effect on accesses to the CPACR.
1 Any access to the CPACR from a Non-secure PL1 mode generates an exception that is
taken to Hyp mode. For more information, see Trapping CPACR accesses on
page B1-1256.
B4-1574 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
TTA, bit[20] Trap Trace Access. The possible values of this bit are:
0 Has no effect on accesses to the CP14 trace registers from Non-secure PL1 and PL2
modes.
1 Any otherwise-valid access to the CP14 trace registers from a Non-secure PL1 mode
generates an exception that is taken to Hyp mode. For more information see Trapping
CP14 accesses to trace registers on page B1-1259.
Any access to the CP14 trace registers from Non-secure Hyp mode is UNDEFINED.
Note
The NSACR.NSTRCDIS bit can make this bit behave as RAO/WI, regardless of its actual value.
In an implementation that does not include a trace macrocell, or does not include a CP14 interface
to the trace macrocell registers, it is IMPLEMENTATION DEFINED whether this bit:
• Is RAO/WI.
• Is RAZ/WI.
• Can be written from Hyp mode, and from Secure Monitor mode when the value of SCR.NS
is 1.
TASE, bit[15] Trap Advanced SIMD Extension use. The possible values of this bit are:
0 Has no effect on accesses to Advanced SIMD functionality from Non-secure PL2, PL1
and PL0 modes.
1 Any otherwise-valid access to Advanced SIMD functionality from a Non-secure PL1 or
PL0 mode generates an exception that is taken to Hyp mode. For more information, see
Trapping of Advanced SIMD functionality on page B1-1255.
Any access to Advanced SIMD functionality from Hyp mode is UNDEFINED. This means
that any instruction encoding that Alphabetical list of instructions on page A8-298
identifies as being an Advanced SIMD instruction but does not also identify as being a
VFPv3 or VFPv4 instruction, is UNDEFINED if executed in Hyp mode.
Note
• If TCP10 and TCP11 are set to 1 then all otherwise-valid Advanced SIMD use by Non-secure
PL1 and PL0 modes is trapped to Hyp mode, regardless of the value of this field.
• The NSACR.NSASEDIS bit can make this bit behave as RAO/WI, regardless of its actual
value.
For more information, see Summary of access controls for Advanced SIMD functionality on
page B1-1232.
On an implementation that:
• Implements the Floating-point Extension but does not implement the Advanced SIMD
Extension, this bit is RAO/WI.
• Does not implement the Floating-point Extension or the Advanced SIMD Extension, this bit
is RAO/WI.
• Implements both the Floating-point Extension and the Advanced SIMD Extension, it is
IMPLEMENTATION DEFINED whether this bit is supported. If it is not supported, it is RAZ/WI.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1575
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
Each NSACR.cpn bit can make the corresponding HCPTR.TCPn bit behave as RAO/WI, regardless
of its actual value.
For values of n that correspond to coprocessors that are not implemented, it is IMPLEMENTATION
DEFINED whether TCPn:
• Is RAO/WI.
• Can be written by software that has write access to HCPTR.
Coprocessors 8, 9, 12, and 13 are reserved for possible use by ARM, and therefore are never
implemented.
If a set of functionality requires the use of more than one coprocessor, then setting the TCPn bits
corresponding to those coprocessors to different values can cause UNPREDICTABLE behavior. For
example, since CP10 and CP11 provide the Floating-point Extension and Advanced SIMD
Extension functionality, TCP10 and TCP11 must be set to the same value.
B4-1576 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HCR provides configuration controls for virtualization, including defining whether
various Non-secure operations are trapped to Hyp mode.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register that resets to zero. See also Reset behavior of CP14 and CP15 registers
on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
TGE FB
TVM VA
TTLB VI
TPU VF
TPC AMO
TSW IMO
TAC FMO
TIDCP PTW
TSC SWIO
TID3 VM
TID2
TID1
TID0
TWE
TWI
DC
• Descriptions of bits describe the effect of setting the bit to 1. If the bit is set to 0 it has no effect on the
operation of the processor.
• A valid Non-secure PL1 or PL0 access means an access from a Non-secure PL1 or PL0 mode that, if the bit
was set to 0, would not be UNDEFINED or UNPREDICTABLE.
TGE, bit[27] Trap general exceptions. When this bit is set to 1, and the processor is executing at PL0 in
Non-secure state, Undefined Instruction exceptions, Supervisor Call exceptions, synchronous
External aborts, and some Alignment faults, are taken to Hyp mode. For more information see
Routing general exceptions to Hyp mode on page B1-1190.
TVM, bit[26] Trap virtual memory controls. When this bit is set to 1, any valid Non-secure PL1 or PL0 write to a
virtual memory control register is trapped to Hyp mode. For more information see Trapping writes
to virtual memory control registers on page B1-1256.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1577
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
TTLB, bit[25] Trap TLB maintenance operations. When this bit is set to 1, any valid Non-secure PL1 or PL0 access
to a TLB maintenance operation is trapped to Hyp mode. For more information see Trapping
accesses to TLB maintenance operations on page B1-1252.
TPU, bit[24] Trap cache maintenance to point of unification operations. When this bit is set to 1, any valid
Non-secure PL1 or PL0 access to a cache maintenance operation that operates to the point of
unification is trapped to Hyp mode. For more information see Trapping accesses to cache
maintenance operations on page B1-1252.
TPC, bit[23] Trap cache maintenance to point of coherency operations. When this bit is set to 1, any valid
Non-secure PL1 or PL0 access to a cache maintenance operation that operates to the point of
coherency is trapped to Hyp mode. For more information see Trapping accesses to cache
maintenance operations on page B1-1252.…
TSW, bit[22] Trap set/way cache maintenance operations. When this bit is set to 1, any valid Non-secure PL1 or
PL0 access to a cache maintenance operation that operates by set/way is trapped to Hyp mode. For
more information see Trapping accesses to cache maintenance operations on page B1-1252.
TAC, bit[21] Trap ACTLR accesses. When this bit is set to 1, any valid Non-secure PL1 or PL0 access to the
ACTLR is trapped to Hyp mode. For more information see Trapping accesses to the Auxiliary
Control Register on page B1-1252.
TIDCP, bit[20]
Trap lockdown. When this bit is set to 1, any valid Non-secure PL1 or PL0 access to a CP15
lockdown, DMA, or TCM operation, is trapped to Hyp mode. For more information, including the
handling of Non-secure accesses at PL0, see Trapping accesses to lockdown, DMA, and TCM
operations on page B1-1251.
TSC, bit[19] Trap SMC instruction.When this bit is set to 1, attempts to execute SMC instructions in Non-secure PL1
modes are trapped to Hyp mode. For more information, including the interaction with the SCR.SCD
bit, see Trapping use of the SMC instruction on page B1-1253.
TWE, bit[14] Trap WFE instruction. When this bit is set to 1, any attempt, from a Non-secure PL1or PL0 mode, to
execute an WFE instruction that might otherwise cause the processor to suspend execution is trapped
to Hyp mode. For more information see Trapping use of the WFI and WFE instructions on
page B1-1253.
TW1, bit[13] Trap WFI instruction. When this bit is set to 1, any attempt, from a Non-secure PL1 or PL0 mode, to
execute an WFI instruction that might otherwise cause the processor to suspend execution is trapped
to Hyp mode. For more information see Trapping use of the WFI and WFE instructions on
page B1-1253
DC, bit[12] Default cacheable. When the Non-secure PL1&0 stage 1 MMU is disabled, this bit affects the
memory type and attributes determined by a Non-secure PL1&0 stage 1 translation. For more
information see VMSA behavior when a stage 1 MMU is disabled on page B3-1312.
BSU, bits[11:10]
Barrier shareability upgrade. When this field is nonzero, it upgrades the required shareability of DMB
and DSB barrier instructions executed in a Non-secure PL1 or PL0 mode, beyond the effect specified
in the instruction. For more information, including the encoding of this field, see Shareability and
access limitations on the data barrier operations on page A3-150.
B4-1578 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
FB, bit[9] Force broadcast. When this bit is set to 1, TLB maintenance operations, branch predictor invalidate
all operations, and instruction cache invalidate all operations performed in Non-secure PL1 modes,
are broadcast across the Inner Shareable domain. For more information see Virtualization
Extensions upgrading of maintenance operations on page B2-1284 and Virtualization Extensions
upgrading of TLB maintenance operations on page B3-1388.
Note
These bits also affect the signaling of virtual asynchronous exceptions.
PTW, bit[2] Protected table walk. When this bit is set to 1 it enables the generation of a stage 2 Permission fault
on a memory access made as part of a stage 1 translation table lookup in the Non-secure PL1&0
translation regime if the stage 2 translation of the access address assigns the Device or
Strongly-ordered attribute. For more information see Stage 2 fault on a stage 1 translation table
walk, Virtualization Extensions on page B3-1399.
SWIO, bit[1] Set/way invalidation override. When this bit is set to 1, it forces invalidate by set/way operations
executed in a Non-secure PL1 mode to be treated as clean and invalidate by set/way operations. For
more information see Virtualization Extensions upgrading of maintenance operations on
page B2-1284.
VM, bit[0] Virtualization MMU enable bit. This is a global enable bit for the PL1&0 stage 2 MMU. The
possible values of this bit are:
0 PL1&0 stage 2 MMU disabled.
For more information see The effects of disabling MMUs on VMSA behavior on
page B3-1312.
1 PL1&0 stage 2 MMU enabled.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1579
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HDCR controls the trapping to Hyp mode of Non-secure accesses, at PL1 or lower, to
functions provided by the debug and trace architectures.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register. See the field descriptions for the reset value of the register. See also
Reset behavior of CP14 and CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
TDRA
TDOSA
TDA
TDE
HPME†
TPM†
TPMCR†
† Only on an implementation that includes the Performance Monitors Extension.
For more information, see the field description.
In the descriptions of the HDCR fields, a valid Non-secure access means an access from a Non-secure PL1 or PL0
mode that, if the bit was set to 0, would not be UNDEFINED or UNPREDICTABLE.
TDRA, bit[11] Trap Debug ROM access. When this bit is set to 1, any valid Non-secure access to the
DBGDRAR or DBGDSAR is trapped to Hyp mode. For more information, including
dependencies on the values of other HDCR bits, see Trapping CP14 accesses to Debug
ROM registers on page B1-1258.
This bit resets to 0.
TDOSA, bit[10] Trap debug OS-related register access. When this bit is set to 1, any valid Non-secure CP14
access to the OS-related registers is trapped to Hyp mode. For more information, including
dependencies on the values of other HDCR bits and a summary of the OS-related registers,
see Trapping CP14 accesses to OS-related debug registers on page B1-1258.
This bit resets to 0.
TDA, bit[9] Trap debug access. When this bit is set to 1, any valid Non-secure access to the CP14 Debug
registers, other than the registers trapped by the TDRA and TDOSA bits, is trapped to Hyp
mode. For more information, including dependencies on the values of other HDCR bits, see
Trapping general CP14 accesses to debug registers on page B1-1258.
This bit resets to 0.
B4-1580 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
TDE, bit[8] Trap Debug exceptions. When this bit is set to 1, any Debug exception taken to Non-secure
state is routed to Hyp mode. For more information, including dependencies on the values of
other HDCR bits, see Routing Debug exceptions to Hyp mode on page B1-1193.
This bit resets to 0.
Bits[7:0], on an implementation that does not include the Performance Monitors Extension
Reserved, UNK/SBZP.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1581
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4-1582 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HDFAR holds the VA of the faulting address that caused a synchronous Data Abort
exception that is taken to Hyp mode.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Any execution in a Non-secure PL1 mode, or in Secure state, makes the HDFAR UNKNOWN.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
VA, bits[31:0] The VA of the address used in the access that faulted, generating a synchronous Data Abort
exception.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1583
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HIFAR holds the VA of the faulting address that caused a synchronous Prefetch Abort
exception that is taken to Hyp mode.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Any execution in a Non-secure PL1 mode, or in Secure state, makes the HIFAR UNKNOWN.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
VA, bits[31:0] The VA of the instruction address used in the instruction fetch that faulted, generating a synchronous
Prefetch Abort exception.
B4-1584 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.69 HMAIRn, Hyp Memory Attribute Indirection Registers 0 and 1, Virtualization Extensions
The HMAIR0 and HMAIR1 characteristics are:
Purpose The HMAIR0 and HMAIR1 registers provide the memory attribute encodings
corresponding to the possible AttrIndx values in a translation table entry for stage 1
translations for memory accesses from Hyp mode. For more information about the AttrIndx
field, see Long-descriptor format memory region attributes on page B3-1368.
Note
Memory accesses from Hyp mode always use the Long-descriptor translation table format.
These registers are part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
AttrIndx[2], from the translation table descriptor, selects the appropriate HMAIR:
• Setting AttrIndx[2] to 0 selects HMAIR0.
• Setting AttrIndx[2] to 1 selects HMAIR1.
Attributes 32-bit RW registers with an UNKNOWN reset values. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
The HMAIRn bit assignments and encodings are identical to those for MAIRn.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1585
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose For some aborts on a stage 2 translation, taken to Hyp mode, HPFAR holds the faulting IPA.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Execution in any Non-secure mode other than Hyp mode makes this register UNKNOWN.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
FIPA, bits[31:4]
Bits[39:12] of the faulting IPA.
B4-1586 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HSCTLR provides top level control of the system operation in Hyp mode. This register
provides Hyp mode control of features controlled by the Banked SCTLR bits, and shows
the values of the non-Banked SCTLR bits.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
(0) (1) (1) (0) (0) (0) (1) (1) FI (0) (1) (0) (1) (0) (0) (0) I (1) (0) (0) (0) (0) (1) (1) (1) C A M
TE EE WXN CP15BEN
TE, bit[30] Thumb Exception enable. This bit controls whether exceptions taken to Hyp mode are taken in
ARM or Thumb state. The possible values of this bit are:
0 Exceptions taken in ARM state.
1 Exceptions taken in Thumb state.
For more information about the use of this bit see Instruction set state on exception entry on
page B1-1181.
EE, bit[25] Exception Endianness bit. The value of this bit defines the value of the CPSR.E bit on entry to an
exception vector in Hyp mode. This value also indicates the endianness of the translation table data
for translation table lookups for the Non-secure PL1&0 stage 2 and PL2 stage 1 address translations.
The possible values of this bit are:
0 Little-endian.
1 Big-endian.
FI, bit[21] Fast interrupts configuration enable bit. The possible values of this bit are:
0 All performance features enabled.
1 Low interrupt latency configuration. Some performance features disabled.
Setting this bit to 1 can reduce interrupt latency in an implementation by disabling
IMPLEMENTATION DEFINED performance features.
This is a read-only bit that takes the value of the SCTLR.FI bit.
For more information, see Low interrupt latency configuration on page B1-1197.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1587
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
WXN, bit[19] Write permission implies XN. The possible values of this bit are:
0 Hyp translations that permit write are not forced to XN.
1 Hyp translations that permit write are forced to XN.
For more information see Preventing execution from writable locations on page B3-1357.
I, bit[12] Instruction cache enable bit: This is a global enable bit for instruction caches, for memory accesses
made in Hyp mode. The possible values of this bit are:
0 Instruction caches disabled.
1 Instruction caches enabled.
If the system does not implement any instruction caches that can be accessed by the processor, at
any level of the memory hierarchy, this bit is RAZ/WI.
If the system implements any instruction caches that can be accessed by the processor then it must
be possible to disable them by setting this bit to 0.
For more information see Cache enabling and disabling on page B2-1268.
CP15BEN, bit[5]
CP15 barrier enable. If implemented, this is an enable bit for use of the CP15 DMB, DSB, and ISB
barrier operations from Hyp mode:
0 CP15 barrier operations disabled. Their encodings are UNDEFINED.
1 CP15 barrier operations enabled.
This bit is optional. If not implemented, bit[5] is RAO/WI. However, it must be implemented if
SCTLR.CP15BEN is implemented.
Note
SCTLR.CP15BEN controls the use of these operations from PL1 and PL0 modes.
For more information about these operations see Data and instruction barrier operations, VMSA on
page B4-1744.
C, bit[2] Cache enable bit. This is a global enable bit for data and unified caches, for memory accesses made
in Hyp mode. The possible values of this bit are:
0 Data or unified caches disabled.
1 Data or unified caches enabled.
If the system does not implement any data or unified caches that can be accessed by the processor,
at any level of the memory hierarchy, this bit is RAZ/WI.
If the system implements any data or unified caches that can be accessed by the processor then it
must be possible to disable them by setting this bit to 0.
For more information see Cache enabling and disabling on page B2-1268.
B4-1588 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
A, bit[1] Alignment bit. This is the enable bit for Alignment fault checking, for memory accesses made in
Hyp mode. The possible values of this bit are:
0 Alignment fault checking disabled.
1 Alignment fault checking enabled.
For more information, see Unaligned data access on page A3-106.
M, bit[0] MMU enable bit. This is a global enable bit for the PL2 stage 1 MMU. The possible values of this
bit are:
0 PL2 stage 1 MMU disabled.
1 PL2 stage 1 MMU enabled.
For more information, see The effects of disabling MMUs on VMSA behavior on page B3-1312.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1589
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HSR holds syndrome information for an exception taken to Hyp mode.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Execution in any Non-secure mode other than Hyp mode makes this register UNKNOWN.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
EC ISS
IL
EC, bits[31:26]
Exception class. The exception class for the exception that is taken to Hyp mode:
• When zero, this field indicates that the reason for the exception is not known. In this case, the
other fields in the register are UNKNOWN.
• Otherwise, the field holds the Exception class for the exception, and the ISS field holds a
syndrome for the exception.
For more information see Use of the HSR on page B3-1421.
IL, bit[25] Instruction length. Indicates the size of the instruction that has been trapped to Hyp mode. The
possible values of this bit are:
0 16-bit instruction.
1 32-bit instruction.
For information about the validity of the IL field see Use of the HSR on page B3-1421. When the
field is not valid it is UNK/SBZP.
ISS, bits[24:0] Instruction-specific syndrome. The interpretation of this field depends on the value of the EC field.
For more information see Use of the HSR on page B3-1421.
B4-1590 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HSTR controls the trapping to Hyp mode of Non-secure accesses, at PL1 or lower, of:
• Use of Jazelle or ThumbEE.
• Access to each of the CP15 primary coprocessor registers, {c0-c3, c5-c13, c15}.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register that resets to zero. See also Reset behavior of CP14 and CP15 registers
on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
TJDBX T10
TTEE T11
T15 T12
T13
In the descriptions of the HSTR fields, a valid Non-secure access means an access that, if the bit was set to 0, would
not be UNDEFINED or UNPREDICTABLE.
Bits[31:18, 14, 4]
Reserved, UNK/SBZP.
TJDBX, bit[17]
Trap Jazelle operations. When this bit is set to 1, any valid Non-secure access to Jazelle functionality
is trapped to Hyp mode. For more information see Trapping accesses to Jazelle functionality on
page B1-1254.
TTEE, bit[16] Trap ThumbEE operations. When this bit is set to 1, any valid Non-secure access to the ThumbEE
configuration registers is trapped to Hyp mode. For more information see Trapping accesses to the
ThumbEE configuration registers on page B1-1254.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1591
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
— From the Non-secure PL0 mode, if the access would not be UNDEFINED if Tx was set
to 0.
For more information see Generic trapping of accesses to CP15 system control registers on
page B1-1256.
Note
A Tn bit traps all accesses to the corresponding CP15 primary coprocessor register. This is unlike
most traps to Hyp mode, including the traps controlled by the TJDBX and TTEE bits, that trap only
otherwise-valid accesses.
B4-1592 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HTCR controls the translation table walks required for the stage 1 translation of
memory accesses from Hyp mode, and holds cacheability and shareability information for
the accesses.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Used in conjunction with HTTBR, that defines the translation table base address for the
translations.
Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
Note
For other address translations, the following registers are equivalent to the HTCR and HTTBR:
• For stage 1 translations for accesses from modes other than Hyp mode, the TTBCR, TTBR0, and TTBR1.
• For stage 2 translations, the VTCR and VTTBR.
31 30 29 24 23 22 14 13 12 11 10 9 8 7 3 2 0
Reserved, Reserved,
(1) (1) Reserved, UNK/SBZP SH0 T0SZ
UNK/SBZP UNK/SBZP
SH0, bits[13:12]
Shareability attribute for memory associated with translation table walks using HTTBR. This field
is encoded as described in Shareability, Long-descriptor format on page B3-1369.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1593
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
ORGN0, bits[11:10]
Outer cacheability attribute for memory associated with translation table walks using HTTBR.
Table B4-4 shows the encoding of this field.
ORGN0 Meaning
IRGN0, bits[9:8]
Inner cacheability attribute for memory associated with translation table walks using HTTBR.
Table B4-5 shows the encoding of this field.
IRGN0 Meaning
T0SZ, bits[2:0]
The size offset of the memory region addressed by HTTBR. This field is encoded as a three-bit
unsigned integer, and the region size is 2(32-T0SZ) bytes.
HTTBR, Hyp Translation Table Base Register, Virtualization Extensions on page B4-1596 describes
how the value of this field determines the width of the translation table base address defined by
HTTBR.
B4-1594 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HTPIDR provides a location where software running in Hyp mode can store thread
identifying information that is not visible to Non-secure software executing at PL0 or PL1,
for hypervisor management purposes.
This register is part of the Miscellaneous operations functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Processor hardware never updates this register.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-52 on page B3-1494 shows the encodings of all of the registers in the
Miscellaneous operations functional group.
For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1595
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HTTBR holds the base address of the translation table for the stage 1 translation of
memory accesses from Hyp mode.
Note
These translations are always defined using the Long-descriptor format translation tables.
Attributes A 64-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
Note
See HTCR, Hyp Translation Control Register, Virtualization Extensions on page B4-1593 for a summary of the
registers that define the translation tables for other address translations.
63 40 39 x x-1 0
BADDR, bits[39:x]
Translation table base address, bits[39:x]. See the text in this section for a description of how x is
defined.
The value of x determines the required alignment of the translation table, which must be aligned to
2x bytes.
The HTCR.T0SZ field determines the width of the defined translation table base address, indicated by the value of
x in the HTTBR description. The following pseudocode calculates the value of x:
T0Size = UInt(HTCR.T0SZ);
if T0Size > 1 then
x = 14 - T0Size;
else
x = 5 - T0Size;
B4-1596 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
MRRC p15, 4, <Rt>, <Rt2>, c2 ; Read 64-bit HTTBR into Rt (low word) and Rt2 (high word)
MCRR p15, 4, <Rt>, <Rt2>, c2 ; Write Rt (low word) and Rt2 (high word) to 64-bit HTTBR
In these MRRC and MCRR instructions, Rt holds the least-significant word of HTTBR, and Rt2 holds the
most-significant word.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1597
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The HVBAR holds the exception base address for any exception that is taken to Hyp mode,
see Exception vectors and the exception base address on page B1-1164.
This register is part of the Virtualization Extensions registers functional group.
Usage constraints Only accessible from Hyp mode, or from Monitor mode when SCR.NS is set to 1, see
PL2-mode system control registers on page B3-1450.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-55 on page B3-1496 shows the encoding of all of the Virtualization Extensions
registers.
The HVBAR bit assignments are:
31 5 4 0
Reserved,
Hyp_Vector_Base_Address
UNK/SBZP
Hyp_Vector_Base_Address, bits[31:5]
Bits[31:5] of the base address of the exception vectors for exceptions that are taken to Hyp mode.
Bits[4:0] of an exception vector is the exception offset, see Table B1-3 on page B1-1166.
For details of how the HVBAR determines the exception addresses see Exception vectors and the exception base
address on page B1-1164.
B4-1598 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
B4.1.79 ICIALLUIS, Instruction Cache Invalidate All to PoU, Inner Shareable, VMSA
Cache and branch predictor maintenance operations, VMSA on page B4-1735 describes this cache maintenance
operation.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the Cache maintenance operations functional group. Table B3-49 on page B3-1491 shows
the encodings of all of the registers and operations in this functional group.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1599
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_AFR0 provides information about the IMPLEMENTATION DEFINED features of the
processor.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Reserved, UNK
IMPLEMENTATION DEFINED
IMPLEMENTATION DEFINED
IMPLEMENTATION DEFINED
IMPLEMENTATION DEFINED
The Auxiliary Feature Register 0 has four 4-bit IMPLEMENTATION FIELDS. These fields are defined by the
implementer of the design. The implementer is identified by the Implementer field of the MIDR.
The Auxiliary Feature Register 0 enables implementers to include additional design features in the CPUID scheme.
Field definitions for the Auxiliary Feature Register 0 might:
• Differ between different implementers.
• Be subject to change.
• Migrate over time, for example if they are incorporated into the main architecture.
Accessing ID_AFR0
To access ID_AFR0, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and
<opc2> set to 3. For example:
B4-1600 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_DFR0 provides top level information about the debug system.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Reserved,
UNK
Performance Monitors
Extension, A and R profiles
Debug model, M profile
Memory-mapped trace model
Coprocessor trace model
Memory-mapped debug model, A and R profiles
Coprocessor Secure debug model, A profile only
Coprocessor debug model, A and R profiles
Note
A value of 0b0000 gives no indication of whether PMUv1 monitors are supported.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1601
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
The ID register, register 0x079, gives more information about the implementation. See
also Trace on page C1-2010.
Note
The permitted field values are not continuous, and values 0b0001, 0b0010, and 0b0011 are reserved.
Note
The permitted field values are not continuous, and values 0b0001 and 0b0010 are reserved.
Note
The permitted field values are not continuous, and value 0b0001 is reserved.
Note
Software can obtain more information about the debug implementation from the debug infrastructure, see Debug
identification registers on page C11-2184.
Accessing ID_DFR0
To access ID_DFR0, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and
<opc2> set to 2. For example:
B4-1602 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_ISAR0 provides information about the instruction sets implemented by the processor.
For more information see About the Instruction Set Attribute registers on page B7-1940.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Divide_instrs, bits[27:24]
Indicates the implemented Divide instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds SDIV and UDIV in the Thumb instruction set.
0b0010 As for 0b0001, and adds SDIV and UDIV in the ARM instruction set.
Debug_instrs, bits[23:20]
Indicates the implemented Debug instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds BKPT.
Coproc_instrs, bits[19:16]
Indicates the implemented Coprocessor instructions. Permitted values are:
0b0000 None implemented, except for instructions separately attributed by the architecture,
including CP15, CP14, Advanced SIMD Extension and the Floating-point Extension.
0b0001 Adds generic CDP, LDC, MCR, MRC, and STC.
0b0010 As for 0b0001, and adds generic CDP2, LDC2, MCR2, MRC2, and STC2.
0b0011 As for 0b0010, and adds generic MCRR and MRRC.
0b0100 As for 0b0011, and adds generic MCRR2 and MRRC2.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1603
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
CmpBranch_instrs, bits[15:12]
Indicates the implemented combined Compare and Branch instructions in the Thumb instruction
set. Permitted values are:
0b0000 None implemented.
0b0001 Adds CBNZ and CBZ.
Bitfield_instrs, bits[11:8]
Indicates the implemented BitField instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds BFC, BFI, SBFX, and UBFX.
BitCount_instrs, bits[7:4]
Indicates the implemented Bit Counting instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds CLZ.
Swap_instrs, bits[3:0]
Indicates the implemented Swap instructions in the ARM instruction set. Permitted values are:
0b0000 None implemented.
0b0001 Adds SWP and SWPB.
Accessing ID_ISAR0
To access ID_ISAR0, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c2, and
<opc2> set to 0. For example:
B4-1604 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_ISAR1 provides information about the instruction sets implemented by the processor.
For more information see About the Instruction Set Attribute registers on page B7-1940.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Jazelle_instrs, bits[31:28]
Indicates the implemented Jazelle extension instructions. Permitted values are:
0b0000 No support for Jazelle.
0b0001 Adds the BXJ instruction, and the J bit in the PSR.
This setting might indicate a trivial implementation of the Jazelle extension.
Interwork_instrs, bits[27:24]
Indicates the implemented Interworking instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the BX instruction, and the T bit in the PSR.
0b0010 As for 0b0001, and adds the BLX instruction. PC loads have BX-like behavior.
0b0011 As for 0b0010, and guarantees that data-processing instructions in the ARM instruction
set with the PC as the destination and the S bit clear have BX-like behavior.
Note
A value of 0b0000, 0b0001, or 0b0010 in this field does not guarantee that an ARM data-processing
instruction with the PC as the destination and the S bit clear behaves like an old MOV PC instruction,
ignoring bits[1:0] of the result. With these values of this field:
• If bits[1:0] of the result value are 0b00 then the processor remains in ARM state.
• If bits[1:0] are 0b01, 0b10 or 0b11, the result must be treated as UNPREDICTABLE.
Immediate_instrs, bits[23:20]
Indicates the implemented data-processing instructions with long immediates. Permitted values are:
0b0000 None implemented.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1605
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
0b0001 Adds:
• The MOVT instruction.
• The MOV instruction encodings with zero-extended 16-bit immediates.
• The Thumb ADD and SUB instruction encodings with zero-extended 12-bit
immediates, and the other ADD, ADR and SUB encodings cross-referenced by the
pseudocode for those encodings.
IfThen_instrs, bits[19:16]
Indicates the implemented If-Then instructions in the Thumb instruction set. Permitted values are:
0b0000 None implemented.
0b0001 Adds the IT instructions, and the IT bits in the PSRs.
Extend_instrs, bits[15:12]
Indicates the implemented Extend instructions. Permitted values are:
0b0000 No scalar sign-extend or zero-extend instructions are implemented, where scalar
instructions means non-Advanced SIMD instructions.
0b0001 Adds the SXTB, SXTH, UXTB, and UXTH instructions.
0b0010 As for 0b0001, and adds the SXTB16, SXTAB, SXTAB16, SXTAH, UXTB16, UXTAB, UXTAB16, and
UXTAH instructions.
Note
In addition:
• The shift options on these instructions are available only if the WithShifts_instrs attribute is
0b0011 or greater.
• The SXTAB16, SXTB16, UXTAB16, and UXTB16 instructions are implemented only if both:
— The Extend_instrs attribute is 0b0010 or greater.
— The SIMD_instrs attribute is 0b0011 or greater.
Except_AR_instrs, bits[11:8]
Indicates the implemented A and R profile exception-handling instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the SRS and RFE instructions, and the A and R profile forms of the CPS instruction.
Except_instrs, bits[7:4]
Indicates the implemented exception-handling instructions in the ARM instruction set. Permitted
values are:
0b0000 Not implemented. This indicates that the User registers and exception return forms of
the LDM and STM instructions are not implemented.
0b0001 Adds the LDM (exception return), LDM (User registers) and STM (User registers) instruction
versions.
Endian_instrs, bits[3:0]
Indicates the implemented Endian instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the SETEND instruction, and the E bit in the PSRs.
Accessing ID_ISAR1
To access ID_ISAR1, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c2, and
<opc2> set to 1. For example:
B4-1606 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_ISAR2 provides information about the instruction sets implemented by the processor.
For more information see About the Instruction Set Attribute registers on page B7-1940.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Reversal_instrs, bits[31:28]
Indicates the implemented Reversal instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the REV, REV16, and REVSH instructions.
0b0010 As for 0b0001, and adds the RBIT instruction.
PSR_AR_instrs, bits[27:24]
Indicates the implemented A and R profile instructions to manipulate the PSR. Permitted values are:
0b0000 None implemented.
0b0001 Adds the MRS and MSR instructions, and the exception return forms of data-processing
instructions described in SUBS PC, LR (Thumb) on page B9-1996 and SUBS PC, LR
and related instructions (ARM) on page B9-1998.
Note
The exception return forms of the data-processing instructions are:
• In the ARM instruction set, data-processing instructions with the PC as the destination and
the S bit set. These instructions might be affected by the WithShifts attribute.
• In the Thumb instruction set, the SUBS PC, LR, #N instruction.
MultU_instrs, bits[23:20]
Indicates the implemented advanced unsigned Multiply instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the UMULL and UMLAL instructions.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1607
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
MultS_instrs, bits[19:16]
Indicates the implemented advanced signed Multiply instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the SMULL and SMLAL instructions.
0b0010 As for 0b0001, and adds the SMLABB, SMLABT, SMLALBB, SMLALBT, SMLALTB, SMLALTT, SMLATB,
SMLATT, SMLAWB, SMLAWT, SMULBB, SMULBT, SMULTB, SMULTT, SMULWB, and SMULWT instructions.
Also adds the Q bit in the PSRs.
0b0011 As for 0b0010, and adds the SMLAD, SMLADX, SMLALD, SMLALDX, SMLSD, SMLSDX, SMLSLD,
SMLSLDX, SMMLA, SMMLAR, SMMLS, SMMLSR, SMMUL, SMMULR, SMUAD, SMUADX, SMUSD, and SMUSDX
instructions.
Mult_instrs, bits[15:12]
Indicates the implemented additional Multiply instructions. Permitted values are:
0b0000 No additional instructions implemented. This means only MUL is implemented.
0b0001 Adds the MLA instruction.
0b0010 As for 0b0001, and adds the MLS instruction.
MultiAccessInt_instrs, bits[11:8]
Indicates the support for interruptible multi-access instructions. Permitted values are:
0b0000 No support. This means the LDM and STM instructions are not interruptible.
0b0001 LDM and STM instructions are restartable.
0b0010 LDM and STM instructions are continuable. Not permitted in ARMv7-A or ARMv7-R.
MemHint_instrs, bits[7:4]
Indicates the implemented Memory Hint instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the PLD instruction.
0b0010 Adds the PLD instruction.
In the MemHint_instrs field, entries of 0b0001 and 0b0010 have identical meanings.
0b0011 As for 0b0001 (or 0b0010), and adds the PLI instruction.
0b0100 As for 0b0011, and adds the PLDW instruction.
LoadStore_instrs, bits[3:0]
Indicates the implemented additional load/store instructions. Permitted values are:
0b0000 No additional load/store instructions implemented.
0b0001 Adds the LDRD and STRD instructions.
Accessing ID_ISAR2
To access ID_ISAR2, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c2, and
<opc2> set to 2. For example:
B4-1608 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_ISAR3 provides information about the instruction sets implemented by the processor.
For more information see About the Instruction Set Attribute registers on page B7-1940.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
ThumbEE_extn_instrs, bits[31:28]
Indicates the implemented Thumb Execution Environment (ThumbEE) Extension instructions.
Permitted values are:
0b0000 None implemented.
0b0001 Adds the ENTERX and LEAVEX instructions, and modifies the load behavior to include null
checking.
Note
This field can only have a value other than 0b0000 when the ID_PFR0.State3 field has a value of
0b0001.
TrueNOP_instrs, bits[27:24]
Indicates the implemented True NOP instructions. Permitted values are:
0b0000 None implemented. This means there are no NOP instructions that do not have any
register dependencies.
0b0001 Adds true NOP instructions in both the Thumb and ARM instruction sets. This also
permits additional NOP-compatible hints.
ThumbCopy_instrs, bits[23:20]
Indicates the support for Thumb non flag-setting MOV instructions. Permitted values are:
0b0000 Not supported. This means that in the Thumb instruction set, encoding T1 of the MOV
(register) instruction does not support a copy from a low register to a low register.
0b0001 Adds support for Thumb instruction set encoding T1 of the MOV (register) instruction,
copying from a low register to a low register.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1609
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
TabBranch_instrs, bits[19:16]
Indicates the implemented Table Branch instructions in the Thumb instruction set. Permitted values
are:
0b0000 None implemented.
0b0001 Adds the TBB and TBH instructions.
SynchPrim_instrs, bits[15:12]
This field is used with the ID_ISAR4.SynchPrim_instrs_frac field to indicate the implemented
Synchronization Primitive instructions. Table B4-6 shows the permitted values of these fields:
0001 0011 As for [0001, 0000], and adds the CLREX, LDREXB, LDREXH, STREXB, and STREXH
instructions
0010 0000 As for [0001, 0011], and adds the LDREXD and STREXD instructions
All combinations of SynchPrim_instrs and SynchPrim_instrs_frac not shown in Table B4-6 are
reserved.
SVC_instrs, bits[11:8]
Indicates the implemented SVC instructions. Permitted values are:
0b0000 Not implemented.
0b0001 Adds the SVC instruction.
Note
The SVC instruction was called the SWI instruction in previous versions of the ARM architecture.
SIMD_instrs, bits[7:4]
Indicates the implemented SIMD instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the SSAT and USAT instructions, and the Q bit in the PSRs.
0b0011 As for 0b0001, and adds the PKHBT, PKHTB, QADD16, QADD8, QASX, QSUB16, QSUB8, QSAX, SADD16,
SADD8, SASX, SEL, SHADD16, SHADD8, SHASX, SHSUB16, SHSUB8, SHSAX, SSAT16, SSUB16, SSUB8,
SSAX, SXTAB16, SXTB16, UADD16, UADD8, UASX, UHADD16, UHADD8, UHASX, UHSUB16, UHSUB8, UHSAX,
UQADD16, UQADD8, UQASX, UQSUB16, UQSUB8, UQSAX, USAD8, USADA8, USAT16, USUB16, USUB8, USAX,
UXTAB16, and UXTB16 instructions.
Also adds support for the GE[3:0] bits in the PSRs.
Note
• In the SIMD_instrs field, the permitted values are not continuous, and the value 0b0010 is
reserved.
• The SXTAB16, SXTB16, UXTAB16, and UXTB16 instructions are implemented only if both:
— The Extend_instrs attribute is 0b0010 or greater.
— The SIMD_instrs attribute is 0b0011 or greater.
• The SIMD_instrs field relates only to implemented instructions that perform SIMD
operations on the ARM core registers. MVFR0 and MVFR1 give information about the
SIMD instructions implemented by the optional Advanced SIMD Extension.
B4-1610 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Saturate_instrs, bits[3:0]
Indicates the implemented Saturate instructions. Permitted values are:
0b0000 None implemented. This means no non-Advanced SIMD saturate instructions are
implemented.
0b0001 Adds the QADD, QDADD, QDSUB, and QSUB instructions, and the Q bit in the PSRs.
Accessing ID_ISAR3
To access ID_ISAR3, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c2, and
<opc2> set to 3. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1611
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_ISAR4 provides information about the instruction sets implemented by the processor.
For more information see About the Instruction Set Attribute registers on page B7-1940.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
SWP_frac, bits[31:28]
Indicates support for the memory system locking the bus for SWP or SWPB instructions. Permitted
values are:
0b0000 SWP or SWPB instructions not implemented.
0b0001 SWP or SWPB implemented but only in a uniprocessor context. SWP and SWPB do not
guarantee whether memory accesses from other masters can come between the load
memory access and the store memory access of the SWP or SWPB.
This field is valid only if the ID_ISAR0.Swap_instrs field is zero.
PSR_M_instrs, bits[27:24]
Indicates the implemented M profile instructions to modify the PSRs. Permitted values are:
0b0000 None implemented.
0b0001 Adds the M profile forms of the CPS, MRS and MSR instructions.
SynchPrim_instrs_frac, bits[23:20]
This field is used with the ID_ISAR3.SynchPrim_instrs field to indicate the implemented
Synchronization Primitive instructions. Table B4-6 on page B4-1610 shows the permitted values of
these fields.
All combinations of SynchPrim_instrs and SynchPrim_instrs_frac not shown in Table B4-6 on
page B4-1610 are reserved.
Barrier_instrs, bits[19:16]
Indicates the implemented Barrier instructions in the ARM and Thumb instruction sets. Permitted
values are:
0b0000 None implemented. Barrier operations are provided only as CP15 operations.
B4-1612 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
SMC_instrs, bits[15:12]
Indicates the implemented SMC instructions. Permitted values are:
0b0000 None implemented.
0b0001 Adds the SMC instruction.
Note
The SMC instruction was called the SMI instruction in previous versions of the ARM architecture.
Writeback_instrs, bits[11:8]
Indicates the support for Writeback addressing modes. Permitted values are:
0b0000 Basic support. Only the LDM, STM, PUSH, POP, SRS, and RFE instructions support writeback
addressing modes. These instructions support all of their writeback addressing modes.
0b0001 Adds support for all of the writeback addressing modes defined in ARMv7.
WithShifts_instrs, bits[7:4]
Indicates the support for instructions with shifts. Permitted values are:
0b0000 Nonzero shifts supported only in MOV and shift instructions.
0b0001 Adds support for shifts of loads and stores over the range LSL 0-3.
0b0011 As for 0b0001, and adds support for other constant shift options, both on load/store and
other instructions.
0b0100 As for 0b0011, and adds support for register-controlled shift options.
Note
• In this field, the permitted values are not continuous, and the value 0b0010 is reserved.
• Additions to the basic support indicated by the 0b0000 field value only apply when the
encoding supports them. In particular, in the Thumb instruction set there is no difference
between the 0b0011 and 0b0100 levels of support.
• MOV instructions with shift options are treated as ASR, LSL, LSR, ROR or RRX instructions, as
described in Data-processing instructions on page B7-1941.
Unpriv_instrs, bits[3:0]
Indicates the implemented unprivileged instructions. Permitted values are:
0b0000 None implemented. No T variant instructions are implemented.
0b0001 Adds the LDRBT, LDRT, STRBT, and STRT instructions.
0b0010 As for 0b0001, and adds the LDRHT, LDRSBT, LDRSHT, and STRHT instructions.
Accessing ID_ISAR4
To access ID_ISAR4, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c2, and
<opc2> set to 4. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1613
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_ISAR5 is reserved for future expansion of the information about the instruction sets
implemented by the processor.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Reserved, UNK
Accessing ID_ISAR5
To access ID_ISAR5, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c2, and
<opc2> set to 5. For example:
B4-1614 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_MMFR0 provides information about the implemented memory model and memory
management support.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1615
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
An ARMv7 implementation might include an ARMv6 model for TCM support. However, in
ARMv7 this is an IMPLEMENTATION DEFINED option, and therefore it must be represented by the
0b0001 encoding in this field.
Accessing ID_MMFR0
To access ID_MMFR0, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and
<opc2> set to 4. For example:
B4-1616 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_MMFR1 provides information about the implemented memory model and memory
management support.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Note
The branch predictor is described in some documentation as the Branch Target Buffer.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1617
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
0b0001 Supported Level 1 data cache test and clean operations are:
• Test and clean data cache.
0b0010 As for 0b0001, and adds:
• Test, clean, and invalidate data cache.
B4-1618 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Accessing ID_MMFR1
To access ID_MMFR1, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and
<opc2> set to 5. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1619
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_MMFR2 provides information about the implemented memory model and memory
management support.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Note
ARM deprecates the use of these operations. ID_ISAR4.Barrier_instrs indicates the level of support
for the preferred barrier instructions.
B4-1620 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
This field is defined only for legacy reasons. It is replaced by the Unified TLB field, bits19:16], and
it must be ignored by software if the Unified TLB field is not 0b0000.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1621
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Accessing ID_MMFR2
To access ID_MMFR2, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and
<opc2> set to 6. For example:
B4-1622 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_MMFR3 provides information about the implemented memory model and memory
management support.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Reserved,
UNK
Supersection support
Cached memory size†
Coherent walk
Maintenance broadcast
BP maintain
Cache maintenance set/way
Cache maintenance MVA
† Only on an implementation that includes the Large Physical Address Extension, otherwise reserved.
Note
The sense of this identification is reversed from the normal usage in the CPUID mechanism, with
the value of zero indicating that the feature is supported.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1623
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
BP maintain, bits[11:8]
Indicates the supported branch predictor maintenance operations in an implementation with
hierarchical cache maintenance operations. Permitted values are:
0b0000 None supported.
0b0001 Supported branch predictor maintenance operations are:
• Invalidate all branch predictors.
0b0010 As for 0b0001, and adds:
• Invalidate branch predictors by MVA.
Accessing ID_MMFR3
To access ID_MMFR3, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and
<opc2> set to7. For example:
B4-1624 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1625
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_PFR0 gives information about the programmers’ model and top-level information about
the instruction sets supported by the processor.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
State3, bits[15:12]
ThumbEE instruction set support. Permitted values are:
0b0000 Not implemented.
0b0001 ThumbEE instruction set implemented.
The value of 0b0001 is only permitted when State1 == 0b0011.
State2, bits[11:8]
Jazelle extension support. Permitted values are:
0b0000 Not implemented.
0b0001 Jazelle extension implemented, without clearing of JOSCR.CV on exception entry.
0b0010 Jazelle extension implemented, with clearing of JOSCR.CV on exception entry.
A trivial implementation of the Jazelle extension is indicated by the value 0b0001.
State1, bits[7:4]
Thumb instruction set support. Permitted values are:
0b0000 Thumb instruction set not implemented.
0b0001 Thumb encodings before the introduction of Thumb-2 technology implemented:
• All instructions are 16-bit.
• A BL or BLX is a pair of 16-bit instructions.
• 32-bit instructions other than BL and BLX cannot be encoded.
0b0010 Reserved.
0b0011 Thumb encodings after the introduction of Thumb-2 technology implemented, for all
16-bit and 32-bit Thumb basic instructions.
B4-1626 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
State0, bits[3:0]
ARM instruction set support. Permitted values are:
0b0000 ARM instruction set not implemented.
0b0001 ARM instruction set implemented.
Accessing ID_PFR0
To access ID_PFR0, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and <opc2>
set to 0. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1627
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose ID_PFR1 gives information about the programmers’ model and Security Extensions
support.
This register is a CPUID register, and is part of the Identification registers functional group.
Configurations The VMSA and PMSA definitions of the register fields are identical.
In a VMSA implementation that includes the Security Extensions, this is a Common
register.
Reserved, UNK
Generic Timer
Virtualization Extensions
M profile programmers’ model
Security Extensions
Programmers’ model
Note
A value of 0b0001 implies implementation of the HVC, ERET, MRS (Banked register), and MSR (Banked
register) instructions. The ID_ISARs do not identify whether these instructions are implemented.
B4-1628 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Note
In this field, the permitted values are not continuous, and the value of 0b0001 is reserved.
Accessing ID_PFR1
To access ID_PFR1, software reads the CP15 registers with <opc1> set to 0, <CRn> set to c0, <CRm> set to c1, and <opc2>
set to 1. For example:
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1629
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The IFAR holds the VA of the faulting access that caused a synchronous Prefetch Abort
exception.
This register is part of the PL1 Fault handling registers functional group.
Configurations If the implementation includes the Security Extensions, this register is Banked.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-46 on page B3-1489 shows the encodings of all of the registers in the PL1 Fault
handling registers functional group.
For information about using the IFAR see Exception reporting in a VMSA implementation on page B3-1406.
B4-1630 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The IFSR holds status information about the last instruction fault.
This register is part of the PL1 Fault handling registers functional group.
Configurations The Large Physical Address Extension adds an alternative format for the register. If an
implementation includes the Large Physical Address Extension then the current translation
table format determines which format of the register is used.
If the implementation includes the Security Extensions, this register is Banked.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-46 on page B3-1489 shows the encodings of all of the registers in the PL1 Fault
handling registers functional group.
For information about using the IFSR see Exception reporting in a VMSA implementation on page B3-1406.
ExT, bit[12] External abort type. This bit can provide an IMPLEMENTATION DEFINED classification of external
aborts.
For aborts other than external aborts this bit always returns 0.
In an implementation that does not provide any classification of external aborts, this bit is
UNK/SBZP.
LPAE, bit[9], if the implementation includes the Large Physical Address Extension
On taking an exception, this bit is set to 0 to indicate use of the Short-descriptor translation table
format.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1631
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Hardware does not interpret this bit to determine the behavior of the memory system, and therefore
software can set this bit to 0 or 1 without affecting operation. Unless the register has been updated
to report a fault, a subsequent read of the register returns the value written to it.
Bits[9], if the implementation does not include the Large Physical Address Extension
Reserved, UNK/SBZP.
ExT
LPAE
* Returned value, but might be overwritten, because the bit is RW.
ExT, bit[12] External abort type. This bit can provide an IMPLEMENTATION DEFINED classification of external
aborts.
For aborts other than external aborts this bit always returns 0.
In an implementation that does not provide any classification of external aborts, this bit is
UNK/SBZP.
LPAE, bit[9] On taking an exception, this bit is set to 1 to indicate use of the Long-descriptor translation table
format.
Hardware does not interpret this bit to determine the behavior of the memory system, and therefore
software can set this bit to 0 or 1 without affecting operation. Unless the register has been updated
to report a fault, a subsequent read of the register returns the value written to it.
STATUS, bits[5:0]
Fault status bits. For the valid encodings of these bits when using the Long-descriptor translation
table format, see Table B3-24 on page B3-1413. All encodings not shown in the table are reserved.
B4-1632 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The ISR shows whether an IRQ, FIQ, or external abort is pending. In an implementation
that includes the Virtualization Extensions, an indicated pending abort or interrupt might be
a physical abort or a virtual abort.
This register is part of the Security Extensions registers functional group.
Attributes A 32-bit RO register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-54 on page B3-1495 shows the encoding of all of the Security Extensions
registers.
On an implementation that includes the Virtualization Extensions, and is in a Non-secure PL1 mode, the
HCR.AMO, HCR.IMO, and HCR.FMO mask override bits determine whether the corresponding ISR bit shows the
status of the physical or the virtual abort or interrupt. When an HCR mask override bit:
• Is set to 0, the ISR bit shows the status of the corresponding physical abort or interrupt.
• Is set to 1, the ISR bit shows the status of the corresponding virtual abort or interrupt.
Note
Non-secure software executing at PL1 cannot access the HCR. When an ISR bit is set to 1 this software cannot
determine whether the reported abort or interrupt is physical or virtual.
Otherwise, the ISR indicates the status of physical external aborts, IRQs, and FIQs.
When the ISR is indicating the status of physical external aborts, IRQs, and FIQs, then:
• The ISR.F and ISR.I bits directly reflect the state of the FIQ and IRQ inputs.
• The signalling of physical external aborts to the processor can be edge triggered or level triggered. If this
signalling is edge triggered, the ISR.A bit is set to 1 when a physical asynchronous abort is recognized, and
automatically cleared to 0 when the abort is taken.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1633
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
The bit positions of the A, I and F bits in the ISR match the A, I and F bits in the CPSR. This means software can
use the same masks to extract the bits from the register value.
This operation is part of the TLB maintenance operations functional group. Table B3-50 on page B3-1492 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the TLB maintenance operations functional group. Table B3-50 on page B3-1492 shows
the encodings of all of the registers and operations in this functional group.
This operation is part of the TLB maintenance operations functional group. Table B3-50 on page B3-1492 shows
the encodings of all of the registers and operations in this functional group.
B4-1634 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints Read access rights depend on the execution privilege and the value of the JOSCR.CD bit.
Write accesses are UNPREDICTABLE at PL1 or higher, and UNDEFINED at PL0. See Access to
Jazelle registers on page A2-99.
Configurations The VMSA and PMSA definitions of the register fields are identical.
Always implemented, but can be implemented as RAZ on a processor with a trivial
implementation of the Jazelle extension.
Note
An implementation that includes the Virtualization Extensions must implement a trivial
implementation of the Jazelle extension.
Architecture, bits[31:28]
Architecture code. This uses the same Architecture code that appears in the MIDR.
On a trivial implementation of the Jazelle extension this field must be RAZ.
Implementer, bits[27:20]
Implementer code of the designer of the subarchitecture. This uses the same Implementer code that
appears in the MIDR.
On a trivial implementation of the Jazelle extension this field must be RAZ.
Subarchitecture, bits[19:12]
Contain the subarchitecture code. The following subarchitecture code is defined:
0x00 Jazelle v1 subarchitecture, or trivial implementation of Jazelle extension if the
Implementer field is RAZ.
On a trivial implementation of the Jazelle extension this field must be RAZ.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1635
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints Access rights depend on the execution privilege and the value of the JOSCR.CD bit, see
Access to Jazelle registers on page A2-99.
Configurations The VMSA and PMSA definitions of the register fields are identical.
Always implemented. A processor with a trivial implementation of the Jazelle extension
must implement JMCR as RAZ/WI.
In an implementation that includes the Security Extensions, JMCR is a Common register.
Attributes A 32-bit RW register. See the field descriptions for details about the reset value.
Table A2-17 on page A2-99 shows the encodings of all the Jazelle registers.
SUBARCHITECTURE DEFINED JE
Bits[31:1] SUBARCHITECTURE DEFINED information. This means the reset value of this field is also
SUBARCHITECTURE DEFINED.
B4-1636 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Provides operating system control of the use of the Jazelle extension by processes and
threads.
This register is a Jazelle register.
Configurations The VMSA and PMSA definitions of the register fields are identical.
Always implemented. A processor with a trivial implementation of the Jazelle extension
must implement JOSCR either:
• As RAZ/WI.
• So that it can be read or written, but the processor ignores the effect of any read or
write.
In an implementation that includes the Security Extensions, JOSCR is a Common register.
Reserved, UNK/SBZP
CV
CD
CV, bit[1] Configuration Valid bit. This bit is used by an operating system to signal to the EJVM that it must
rewrite its configuration to the configuration registers. The possible values are:
0 Configuration not valid. The EJVM must rewrite its configuration to the configuration
registers before it executes another bytecode instruction.
1 Configuration valid. The EJVM does not need to update the configuration registers.
When the JMCR.JE bit is set to 1, the CV bit also controls entry to Jazelle state, see Controlling
entry to Jazelle state on page B1-1242.
CD, bit[0] Configuration Disabled bit. This bit is used by an operating system to disable User mode access to
the JIDR and configuration registers:
0 Configuration enabled. Access to the Jazelle registers, including User mode accesses,
operate normally. For more information, see the register descriptions in Application
level configuration and control of the Jazelle extension on page A2-98.
1 Configuration disabled in User mode. User mode access to the Jazelle registers are
UNDEFINED, and all User mode accesses to the Jazelle registers cause an Undefined
Instruction exception.
For more information about the use of this bit see Monitoring and controlling User mode access to
the Jazelle extension on page B1-1243.
The JOSCR provides a control mechanism that is independent of the subarchitecture of the Jazelle extension. An
operating system can use this mechanism to control access to the Jazelle extension, see Jazelle state configuration
and control on page B1-1242.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1637
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4-1638 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4.1.104 MAIR0 and MAIR1, Memory Attribute Indirection Registers 0 and 1, VMSA
The MAIR0 and MAIR1 characteristics are:
Purpose MAIR0 and MAIR1 provide the memory attribute encodings corresponding to the possible
AttrIndx values in a Long-descriptor format translation table entry for stage 1 translations.
For more information about the AttrIndx field see Long-descriptor format memory region
attributes on page B3-1368.
These registers are part of the Virtual memory control registers functional group.
Configurations MAIR0 and MAIR1 are implemented only as part of the Large Physical Address Extension.
In an implementation that includes the Security Extensions they:
• Are Banked.
• Have write access to the Secure copy of the register disabled when the
CP15SDISABLE signal is asserted HIGH.
Attributes 32-bit RW registers with UNKNOWN reset values. See also Reset behavior of CP14 and CP15
registers on page B3-1446.
Table B3-45 on page B3-1488 shows the encodings of all of the registers in the Virtual
memory control registers functional group.
31 24 23 16 15 8 7 0
MAIR0 Attr3 Attr2 Attr1 Attr0
MAIR1 Attr7 Attr6 Attr5 Attr4
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1639
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Attrm[7:4] Meaning
a. See encoding of Attrm[3:0], shown in Table B4-8, for Inner cacheability policies.
b. R defines the Outer Read-Allocate policy, and W defined the Outer Write-Allocate policy, see
Table B4-9 on page B4-1641.
c. Non-transient if the implementation includes support for the Transient attribute.
The encoding of Attrn[3:0] depends on the value of Attrn[7:4], as Table B4-8 shows.
Attrm[3:0] Meaning when Attrm[7:4] is 0b0000 Meaning when Attrm[7:4] is not 0b0000
a. R defines the Inner Read-Allocate policy, and W defines the Inner Write-Allocate policy, see Table B4-9 on page B4-1641.
b. Non-transient if the implementation includes support for the Transient attribute.
B4-1640 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Table B4-9 shows the encoding of the R and W bits that are used, in some Attrm encodings in
Table B4-7 on page B4-1640 and Table B4-8 on page B4-1640, to define the read-allocate and
write-allocate policies:
R or W Meaning
0 Do not allocate
1 Allocate
The IMPLEMENTATION DEFINED meanings of the Attrm[7:4] Attrm[3:0] 0b0xyy encodings must be
consistent. This means that the IMPLEMENTATION DEFINED choice is that either:
• All of these encodings are UNPREDICTABLE.
• This set of encodings provides the Normal memory Write-Through transient and Write-Back
transient encodings.
See Transient cacheability attribute, Large Physical Address Extension on page A3-132 for more
information about the Transient attribute.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1641
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The MIDR provides identification information for the processor, including an implementer
code for the device and a device ID number.
This register is part of the Identification registers functional group.
Configurations If the implementation includes the Security Extensions, this register is Common.
Some fields of the MIDR are IMPLEMENTATION DEFINED. For details of the values of these
fields for a particular ARMv7 implementation, and any implementation-specific
significance of these values, see the product documentation.
Attributes A 32-bit RO register with an IMPLEMENTATION DEFINED value. See also Reset behavior of
CP14 and CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
The MIDR bit assignments are:
31 24 23 20 19 16 15 4 3 0
Implementer, bits[31:24]
The Implementer code. Table B4-10 shows the permitted values for this field:
All other values are reserved by ARM and must not be used.
Variant, bits[23:20]
An IMPLEMENTATION DEFINED variant number. Typically, this field distinguishes between different
product variants, or major revisions of a product.
B4-1642 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Architecture, bits[19:16]
Table B4-11 shows the permitted values for this field:
Bits[19:16] Architecture
0x1 ARMv4
0x2 ARMv4T
0x4 ARMv5T
0x5 ARMv5TE
0x6 ARMv5TEJ
0x7 ARMv6
All other values are reserved by ARM and must not be used.
Note
• On processors implemented by ARM, if the top four bits of the primary part number are 0x0
or 0x7, the variant and architecture are encoded differently, see the description of the MIDR
in Appendix D15 ARMv4 and ARMv5 Differences.
• Processors implemented by ARM have an Implementer code of 0x41.
Revision, bits[3:0]
An IMPLEMENTATION DEFINED revision number for the device.
ARMv7 requires all implementations to use the CPUID scheme, described in Chapter B7 The CPUID Identification
Scheme, and an implementation is described by the MIDR with the CPUID registers.
Note
For an ARMv7 implementation by ARM, the MIDR is interpreted as:
Bits[31:24] Implementer code, must be 0x41.
Bits[23:20] Major revision number, rX.
Bits[19:16] Architecture code, must be 0xF.
Bits[15:4] ARM part number.
Bits[3:0] Minor revision number, pY.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1643
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Attributes A 32-bit RO register with an IMPLEMENTATION DEFINED value. See also Reset behavior of
CP14 and CP15 registers on page B3-1446.
Table B3-44 on page B3-1487 shows the encodings of all of the registers in the
Identification registers functional group.
In an implementation that does not include the Multiprocessing Extensions, the MPIDR bit assignments are:
31 24 23 16 15 8 7 0
In an implementation that includes the Multiprocessing Extensions, the MPIDR bit assignments are:
31 30 29 25 24 23 16 15 8 7 0
Reserved,
1 U Aff2 Aff1 Aff0
UNK
MT
Note
In the MPIDR bit definitions, a processor in the system can be a physical processor or a virtual machine.
B4-1644 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Aff2, bits[23:16]
Affinity level 2. The least significant affinity level field, for this processor in the system.
Aff1, bits[15:8]
Affinity level 1. The intermediate affinity level field, for this processor in the system.
Aff0, bits[7:0]
Affinity level 0. The most significant affinity level field, for this processor in the system.
See Recommended use of the MPIDR for clarification of the meaning of most significant and least significant
affinity levels.
The assigned value of the MPIDR.{Aff0, Aff1, Aff2} set of fields must be unique for each processor in the system
as a whole.
When matching against an affinity level field, scheduler software checks for a value equal to or greater than a
required value.
Recommended use of the MPIDR includes a description of an example multiprocessor system and the affinity level
field values it might use.
The interpretation of these fields is IMPLEMENTATION DEFINED, and must be documented as part of the
documentation of the multiprocessor system. ARM recommends that this register might be used as described in
Recommended use of the MPIDR.
The software mechanism to discover the total number of affinity numbers used at each level is IMPLEMENTATION
DEFINED, and is part of the general system identification task.
In this situation, the performance of the original thread might be significantly reduced.
Note
In this description, thread always refers to a thread or a process.
• Identifying special functionality of a particular processor in the system. In general, the actual meaning of the
affinity level fields is not important. In a small number of situations, an affinity level field value might have
a special IMPLEMENTATION DEFINED significance. Possible examples include booting from reset and
powerdown events.
• Providing affinity information for the scheduling software, to help the scheduler run an individual thread or
process on either:
— The same processor, or as similar a processor as possible, as the processor it was running on
previously.
— A processor on which a related thread or process was run.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1645
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
MPIDR provides a mechanism with up to three levels of affinity information, but the meaning of those levels of
affinity is entirely IMPLEMENTATION DEFINED. The levels of affinity provided can have different meanings.
Table B4-12 shows two possible implementations:
The scheduler maintains affinity level information for all threads and processes. When it has to reschedule a thread
or process, the scheduler:
1. Looks for an available processor that matches at all three affinity levels.
2. If step 1 fails, the scheduler might look for a processor that matches at levels 1 and 2 only.
3. If the scheduler still cannot find an available processor it might look for a match at level 2 only.
A multiprocessor system corresponding to Example system 1 in Table B4-12 might implement affinity values as
shown in Table B4-13:
Aff2, Cluster level, values Aff1, Processor level, values Aff0, Virtual CPU level, values
0 0 0, 1
0 1 0, 1
0 2 0, 1
0 3 0, 1
1 0 0, 1
1 1 0, 1
1 2 0, 1
1 3 0, 1
B4-1646 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose The MVBAR holds the exception base address for all exceptions that are taken to Monitor
mode, see Exception vectors and the exception base address on page B1-1164.
This register is part of the Security Extensions registers functional group.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-54 on page B3-1495 shows the encoding of all of the Security Extensions
registers.
Monitor_Vector_Base_Address, bits[31:5]
Bits[31:5] of the base address of the exception vectors for exceptions that are taken to Monitor
mode. Bits[4:0] of an exception vector is the exception offset, see Table B1-3 on page B1-1166.
For details of how the MVBAR determines the exception addresses see Exception vectors and the exception base
address on page B1-1164.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1647
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Describes the features provided by the Advanced SIMD and Floating-point Extensions.
Usage constraints Only accessible from PL1 or higher. See Accessing the Advanced SIMD and Floating-point
Extension system registers on page B1-1236 for more information.
Must be interpreted with MVFR1. This register complements the information provided by
the CPUID scheme described in Chapter B7 The CPUID Identification Scheme.
Note
• The VSQRT.F32 instruction also requires the single-precision Floating-point attribute,
bits[7:4].
B4-1648 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Divide, bits[19:16]
Indicates the hardware support for Floating-point Extension divide operations. Permitted values are:
0b0000 Not supported in hardware.
0b0001 Supported.
Note
• The VDIV.F32 instruction also requires the single-precision Floating-point attribute, bits[7:4].
• The VDIV.F64 instruction also requires the double-precision Floating-point attribute,
bits[11:8].
Double-precision, bits[11:8]
Indicates the hardware support for the Floating-point Extension double-precision operations.
Permitted values are:
0b0000 Not supported in hardware.
0b0001 Supported, VFPv2.
0b0010 Supported, VFPv3 or VFPv4.
VFPv3 adds an instruction to load a double-precision floating-point constant, and
conversions between double-precision and fixed-point values.
A value of 0b0001 or 0b0010 indicates support for all the floating-point double-precision instructions
in the supported version of the Floating-point Extension, except that, in addition to this field being
nonzero:
• VSQRT.F64 is available only if the Square root field is 0b0001.
• VDIV.F64 is available only if the Divide field is 0b0001.
• Conversion between double-precision and single-precision is available only if the
single-precision field is nonzero.
Single-precision, bits[7:4]
Indicates the hardware support for the Floating-point Extension single-precision operations.
Permitted values are:
0b0000 Not supported in hardware.
0b0001 Supported, VFPv2.
0b0010 Supported, VFPv3 or VFPv4.
VFPv3 adds an instruction to load a single-precision floating-point constant, and
conversions between single-precision and fixed-point values.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1649
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
A value of 0b0001 or 0b0010 indicates support for all floating-point single-precision instructions in
the supported version of the Floating-point Extension, except that, in addition to this field being
nonzero:
• VSQRT.F32 is only available if the Square root field is 0b0001.
• VDIV.F32 is only available if the Divide field is 0b0001.
• Conversion between double-precision and single-precision is only available if the
double-precision field is nonzero.
Accessing MVFR0
Software accesses MVFR0 using the VMRS instruction, see VMRS on page B9-2000. For example:
B4-1650 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Describes the features provided by the Advanced SIMD and Floating-point Extensions.
Usage constraints Only accessible from PL1 or higher. See Accessing the Advanced SIMD and Floating-point
Extension system registers on page B1-1236 for more information.
Must be interpreted with MVFR0. These registers complement the information provided by
the CPUID scheme described in Chapter B7 The CPUID Identification Scheme.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1651
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Accessing MVFR1
Software accesses MVFR1 using the VMRS instruction, see VMRS on page B9-2000. For example:
B4-1652 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Purpose Under the conditions described in Architectural status of PRRR and NMRR on
page B4-1695, NMRR provides additional mapping controls for memory regions that are
mapped as Normal memory by their entry in the PRRR. For more information see
Short-descriptor format memory region attributes, with TEX remap on page B3-1364.
This register is part of the Virtual memory control registers functional group.
Attributes A 32-bit RW register with an UNKNOWN reset value. See also Reset behavior of CP14 and
CP15 registers on page B3-1446.
Table B3-45 on page B3-1488 shows the encodings of all of the registers in the Virtual
memory control registers functional group.
OR7 OR6 OR5 OR4 OR3 OR2 OR1 OR0 IR7 IR6 IR5 IR4 IR3 IR2 IR1 IR0
For more information about the NMRR see Short-descriptor format memory region attributes, with TEX remap on
page B3-1364.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1653
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
B4-1654 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
Usage constraints Only accessible from PL1 or higher, with access rights that depend on the mode and security
state:
• The NSACR is read/write in Secure PL1 modes.
• The NSACR is read-only in Non-secure PL1 and PL2 modes.
Configurations The NSCAR is implemented only as part of the Security Extensions. It is a Restricted access
register, but can be read from Non-secure state.
Attributes A 32-bit RW register with a reset value that depends on the implementation. For more
information, see the register field descriptions. See also Reset behavior of CP14 and CP15
registers on page B3-1446.
Table B3-54 on page B3-1495 shows the encoding of all of the Security Extensions
registers.
Reserved, UNK/SBZP
NSTRCDIS, bit[20]
Disable Non-secure access to CP14 trace registers.
The implementation of this bit must correspond to the implementation of the CPACR.TRCDIS bit:
• If CPACR.TRCDIS is RAZ/WI then this bit is RAZ/WI.
• If CPACR.TRCDIS is RW then this bit is RW.
If NSTRCDIS is RW its possible values are:
0 This bit has no effect on the ability to write to CPACR.TRCDIS.
1 When executing in Non-secure state:
• CPACR.TRCDIS behaves as RAO/WI, regardless of its actual value.
• In an implementation that includes the Virtualization Extensions, HCPTR.TTA
behaves as RAO/WI, regardless of its actual value.
See the CPACR.TRCDIS description for more information about when this bit can be RW.
If this bit is implemented as an RW bit, it resets to 0.
ARM DDI 0406C.d Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. B4-1655
ID040418 Non-Confidential
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order
These bits can define the Non-secure access permissions for IMPLEMENTATION DEFINED features.
NSASEDIS, bit[15]
Disable Non-secure Advanced SIMD functionality.
The implementation of this bit must correspond to the implementation of the CPACR.ASEDIS bit.
This means:
• If a processor:
— Implements the Floating-point Extension but does not implement the Advanced SIMD
Extension, this bit is RAO/WI.
— Does not implement the Floating-point Extension or the Advanced SIMD Extension,
this bit is this bit is UNK/SBZP.
• If a processor implements both the Floating-point Extension and the Advanced SIMD
Extension, it is IMPLEMENTATION DEFINED whether CPACR.ASEDIS is RAZ/WI or RW, and
the NSASEDIS bit must behave in the same way.
If NSASEDIS is RW, its possible values are:
0 This bit has no effect on the ability to write to CPACR.ASEDIS.
1 When executing in Non-secure state:
• CPACR.ASEDIS behaves as RAO/WI, regardless of its actual value.
• In an implementation that includes the Virtualization Extensions, HCPTR.TASE
behaves as RAO/WI, regardless of its actual value.
If this bit is implemented as an RW bit, it resets to 0.
NSD32DIS, bit[14]
Disable Non-secure use of registers D16-D31 of the Floating-point Extension register file
The implementation of this bit must correspond to the implementation of the CPACR.D32DIS bit.
This means:
• If a processor:
— Implements the Floating-point Extension but does not implement D16-D31, this bit is
RAO/WI.
— Does not implement Floating-point Extension, this bit is UNK/SBZP.
• If a processor implements the Floating-point Extension and implements D16-D31, it is
IMPLEMENTATION DEFINED whether CPACR.D32DIS is RAZ/WI or RW, and the NSD32DIS
must behave in the same way.
If NSD32DIS is RW, its possible values are:
0 This bit has no effect on the ability to write to CPACR.D32DIS.
1 When executing in Non-secure state, CPACR.D32DIS is RAO/WI.
When this bit is RW, if it is set to 1 when NSACR.NSASEDIS is set to 0, the result is
UNPREDICTABLE.
B4-1656 Copyright © 1996-1998, 2000, 2004-2012, 2014, 2018 ARM Limited. All rights reserved. ARM DDI 0406C.d
Non-Confidential ID040418
B4 System Control Registers in a VMSA implementation
B4.1 VMSA System control registers descriptions, in register order