[PATCH] D37953: [ARM] Relax `cpsie`/`cpsid` flag parsing.

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 16 18:11:32 PDT 2017


jroelofs created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.

The ARM docs suggest in examples that the flags can have either case, and there are applications in the wild that (libopencm3, for example) that expect to be able to use the uppercase spelling.


https://reviews.llvm.org/D37953

Files:
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  test/MC/ARM/basic-arm-instructions.s


Index: test/MC/ARM/basic-arm-instructions.s
===================================================================
--- test/MC/ARM/basic-arm-instructions.s
+++ test/MC/ARM/basic-arm-instructions.s
@@ -791,10 +791,12 @@
 @ CPS
 @------------------------------------------------------------------------------
         cpsie  aif
+        cpsie  AIF
         cps  #15
         cpsid  if, #10
 
 @ CHECK: cpsie  aif @ encoding: [0xc0,0x01,0x08,0xf1]
+@ CHECK: cpsie  aif @ encoding: [0xc0,0x01,0x08,0xf1]
 @ CHECK: cps  #15 @ encoding: [0x0f,0x00,0x02,0xf1]
 @ CHECK: cpsid  if, #10 @ encoding: [0xca,0x00,0x0e,0xf1]
 
Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -4023,7 +4023,7 @@
   unsigned IFlags = 0;
   if (IFlagsStr != "none") {
         for (int i = 0, e = IFlagsStr.size(); i != e; ++i) {
-      unsigned Flag = StringSwitch<unsigned>(IFlagsStr.substr(i, 1))
+      unsigned Flag = StringSwitch<unsigned>(IFlagsStr.substr(i, 1).lower())
         .Case("a", ARM_PROC::A)
         .Case("i", ARM_PROC::I)
         .Case("f", ARM_PROC::F)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37953.115551.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170917/9196719c/attachment.bin>


More information about the llvm-commits mailing list