Restrictions
ในคำสั่งเหล่านี้:
• Operand2 ต้องไม่เป็นทั้ง SP หรือ PC
• Rd สามารถเป็น SP เฉพาะใน ADD และ SUB, และเฉพาะกับข้อจำกัดเพิ่มเติมต่อไปนี้:
– Rn ต้องเป็น SP ด้วย
– การเลื่อนใดๆใน operand2 ต้องถูกจำกัดถึงสูงสุดของสามบิตโดยใช้ LSL
• Rn สามารถเป็น SP เฉพาะใน ADD และ SUB
• Rd สามารถเป็น PC เฉพาะใน the ADD{cond} PC, PC, Rm instruction โดยที่:
– คุณต้องไม่ระบุ the S suffix
– Rm ต้องไม่เป็นทั้ง PC หรือ SP
– หากคำสั่งเป็นแบบมีเงื่อนไข มันต้องเป็นคำสั่งสุดท้ายใน the IT block
• ด้วยข้อยกเว้นของ the ADD{cond} PC, PC, Rm instruction, Rn สามารถเป็น PC เฉพาะใน ADD and SUB, และเฉพาะกับข้อ
จำกัดเพิ่มเติมต่อไปนี้:
– คุณต้องไม่ระบุ the S suffix
– The second operand ต้องเป็น a constant ในช่วง 0 ถึง 4095
Note: 1 เมื่อใช้ the PC สำหรับการบวกหรือการลบ, bits[1:0] ของ the PC จะถูกปัดเศษเป็น b00 ก่อนดำเนินการ the calculation,
กำหนด the base address สำหรับ the calculation word-aligned.
2 ถ้าคุณต้องการสร้าง the address ของคำสั่ง, คุณต้องปรับ the constant ตามค่าของ the PC. Arm ขอแนะนำให้คุณใช้ the
ADR instruction แทน ADD หรือ SUB ที่มี Rn เท่ากับ the PC, เนื่องจาก assembler ของคุณจะคำนวณ the correct
constant สำหรับ the ADR instruction โดยอัตโนมัติ.
เมื่อ Rd คือ PC ใน the ADD{cond} PC, PC, Rm instruction:
• bit[0] ของค่าที่เขียนไปยัง the PC จะถูกละเว้น
• A branch เกิดขึ้นกับ the address ที่สร้างขึ้นโดยการบังคับ bit[0] ของค่านั้นเป็น 0
Condition flags
ถ้า S ถูกระบุ, คำสั่งเหล่านี้จะอัฟเดต the N, Z, C and V flags สอดคล้องกับ the result
Examples
ADDR2, R1, R3
SUBSR8, R6, #240; sets the flags on the result
RSBR4, R4, #1280; subtracts contents of R4 from 1280
ADCHIR11, R0, R3; only executed if C flag set and Z
; flag clear