[PATCH] D11056: [ARM] Don't be overzealous converting Thumb1 3 to 2 operands

scott douglass sdouglass at arm.com
Thu Jul 9 07:14:21 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL241801: [ARM] Don't be overzealous converting Thumb1 3 to 2 operands (authored by scott-0).

Changed prior to commit:
  http://reviews.llvm.org/D11056?vs=29310&id=29328#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11056

Files:
  llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  llvm/trunk/test/MC/ARM/thumb_rewrites.s

Index: llvm/trunk/test/MC/ARM/thumb_rewrites.s
===================================================================
--- llvm/trunk/test/MC/ARM/thumb_rewrites.s
+++ llvm/trunk/test/MC/ARM/thumb_rewrites.s
@@ -1,5 +1,11 @@
 @ RUN: llvm-mc -triple thumbv6m -show-encoding < %s | FileCheck %s
 
+    adds    r1, r1, #3
+@ CHECK: adds   r1, r1, #3          @ encoding: [0xc9,0x1c]
+
+    adds    r1, #3
+@ CHECK: adds   r1, #3              @ encoding: [0x03,0x31]
+
     adds    r0, r0, #8
 @ CHECK: adds   r0, #8              @ encoding: [0x08,0x30]
 
@@ -34,6 +40,12 @@
     subs    r0, r0, r0
 @ CHECK: subs   r0, r0, r0          @ encoding: [0x00,0x1a]
 
+    subs    r3, r3, #5
+@ CHECK: subs   r3, r3, #5          @ encoding: [0x5b,0x1f]
+
+    subs    r3, #5
+@ CHECK: subs   r3, #5              @ encoding: [0x05,0x3b]
+
     subs    r2, r2, #8
 @ CHECK: subs   r2, #8              @ encoding: [0x08,0x3a]
 
Index: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5512,6 +5512,11 @@
     if (((Mnemonic == "add" && CarrySetting) || Mnemonic == "sub") &&
         Op5.isReg())
       Transform = false;
+
+    // Don't transform 'add/sub{s} Rd, Rd, #imm' if the immediate fits into
+    // 3-bits because the ARMARM says not to.
+    if ((Mnemonic == "add" || Mnemonic == "sub") && Op5.isImm0_7())
+      Transform = false;
   }
 
   if (Transform)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11056.29328.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150709/7a191610/attachment.bin>


More information about the llvm-commits mailing list