[ARM] Fix subtarget feature set truncation when using .cpu directive
authorBradley Smith <bradley.smith@arm.com>
Wed, 4 Feb 2015 16:23:24 +0000 (16:23 +0000)
committerBradley Smith <bradley.smith@arm.com>
Wed, 4 Feb 2015 16:23:24 +0000 (16:23 +0000)
This is a bug that was caused due to storing the feature bitset in a 32-bit
variable when it is a 64-bit mask, discarding the top half of the feature set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228151 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/cpu-test.s

index 3b7a67d0d1f061b15a3c8a11fb4acec370c031f8..b89f453d27d5a6c17a60d24e52f65f2a7a144262 100644 (file)
@@ -9182,8 +9182,7 @@ bool ARMAsmParser::parseDirectiveCPU(SMLoc L) {
   // see: http://llvm.org/bugs/show_bug.cgi?id=20757
   STI.InitMCProcessorInfo(CPU, "");
   STI.InitCPUSchedModel(CPU);
-  unsigned FB = ComputeAvailableFeatures(STI.getFeatureBits());
-  setAvailableFeatures(FB);
+  setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
 
   return false;
 }
index 766e454d080a6c34c9acca3b11e534a22d5e1751..7a6190758884b7a583157f1b5746aed8038be359 100644 (file)
@@ -11,3 +11,7 @@ dsb
 dsb
 // CHECK-ERROR: error: Unknown CPU name
 .cpu foobar
+// CHECK: .cpu cortex-m3
+.cpu cortex-m3
+// CHECK: sub sp, #16
+sub sp,#16