[llvm] r213850 - [ARM] Make the assembler reject unpredictable pre/post-indexed ARM STRH instructions.

Tilmann Scheller t.scheller at samsung.com
Thu Jul 24 02:55:46 PDT 2014


Author: tilmann
Date: Thu Jul 24 04:55:46 2014
New Revision: 213850

URL: http://llvm.org/viewvc/llvm-project?rev=213850&view=rev
Log:
[ARM] Make the assembler reject unpredictable pre/post-indexed ARM STRH instructions.

The ARM ARM prohibits STRH instructions with writeback into the source register. With this commit this constraint is now enforced and we stop assembling STRH instructions with unpredictable behavior.

Modified:
    llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
    llvm/trunk/test/MC/ARM/diagnostics.s

Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=213850&r1=213849&r2=213850&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Jul 24 04:55:46 2014
@@ -5732,6 +5732,8 @@ bool ARMAsmParser::validateInstruction(M
   case ARM::STR_PRE_REG:
   case ARM::STR_POST_IMM:
   case ARM::STR_POST_REG:
+  case ARM::STRH_PRE:
+  case ARM::STRH_POST:
   case ARM::STRB_PRE_IMM:
   case ARM::STRB_PRE_REG:
   case ARM::STRB_POST_IMM:

Modified: llvm/trunk/test/MC/ARM/diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/diagnostics.s?rev=213850&r1=213849&r2=213850&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/diagnostics.s (original)
+++ llvm/trunk/test/MC/ARM/diagnostics.s Thu Jul 24 04:55:46 2014
@@ -496,6 +496,10 @@ foo2:
         str r0, [r0, r1]!
         str r0, [r0], #4
         str r0, [r0], r1
+        strh r0, [r0, #2]!
+        strh r0, [r0, r1]!
+        strh r0, [r0], #2
+        strh r0, [r0], r1
         strb r0, [r0, #1]!
         strb r0, [r0, r1]!
         strb r0, [r0], #1
@@ -513,6 +517,18 @@ foo2:
 @ CHECK-ERRORS: str r0, [r0], r1
 @ CHECK-ERRORS:         ^
 @ CHECK-ERRORS: error: source register and base register can't be identical
+@ CHECK-ERRORS: strh r0, [r0, #2]!
+@ CHECK-ERRORS:          ^
+@ CHECK-ERRORS: error: source register and base register can't be identical
+@ CHECK-ERRORS: strh r0, [r0, r1]!
+@ CHECK-ERRORS:          ^
+@ CHECK-ERRORS: error: source register and base register can't be identical
+@ CHECK-ERRORS: strh r0, [r0], #2
+@ CHECK-ERRORS:          ^
+@ CHECK-ERRORS: error: source register and base register can't be identical
+@ CHECK-ERRORS: strh r0, [r0], r1
+@ CHECK-ERRORS:          ^
+@ CHECK-ERRORS: error: source register and base register can't be identical
 @ CHECK-ERRORS: strb r0, [r0, #1]!
 @ CHECK-ERRORS:          ^
 @ CHECK-ERRORS: error: source register and base register can't be identical





More information about the llvm-commits mailing list