]> granicus.if.org Git - clang/commitdiff
Cortex-M3 and Cortex-M4 should not enable hwdiv-arm (committing again, with an update...
authorArtyom Skrobov <Artyom.Skrobov@arm.com>
Wed, 29 Jan 2014 09:43:07 +0000 (09:43 +0000)
committerArtyom Skrobov <Artyom.Skrobov@arm.com>
Wed, 29 Jan 2014 09:43:07 +0000 (09:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200385 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/CodeGen/arm-cortex-cpus.c [new file with mode: 0644]

index 94c8ea959896a6feaed309613e6be032c49e5a99..b313ac44b2d36fe65301df6ec34087a2cd3a864d 100644 (file)
@@ -3832,14 +3832,15 @@ public:
       Features["hwdiv"] = true;
       Features["hwdiv-arm"] = true;
       Features["crc"] = true;
-    } else if (CPU == "cortex-r5" || CPU == "cortex-m3" ||
-               CPU == "cortex-m4" ||
+    } else if (CPU == "cortex-r5" ||
                // Enable the hwdiv extension for all v8a AArch32 cores by
                // default.
                ArchName == "armv8a" || ArchName == "armv8" ||
                ArchName == "thumbv8a" || ArchName == "thumbv8") {
       Features["hwdiv"] = true;
       Features["hwdiv-arm"] = true;
+    } else if (CPU == "cortex-m3" || CPU == "cortex-m4") {
+      Features["hwdiv"] = true;
     }
   }
 
diff --git a/test/CodeGen/arm-cortex-cpus.c b/test/CodeGen/arm-cortex-cpus.c
new file mode 100644 (file)
index 0000000..d8d9830
--- /dev/null
@@ -0,0 +1,11 @@
+// REQUIRES: arm-registered-target
+
+// Check that Cortex-M cores don't enable hwdiv-arm (and don't emit Tag_DIV_use)
+//
+// This target feature doesn't affect C predefines, nor the generated IR;
+// only the build attributes in generated assembly and object files are affected.
+
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m3 -S %s -o - | FileCheck %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m4 -S %s -o - | FileCheck %s
+// CHECK-NOT: .eabi_attribute  44
+