Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -3917,7 +3917,7 @@ ArchName == "thumbebv8a" || ArchName == "thumbebv8") { Features["hwdiv"] = true; Features["hwdiv-arm"] = true; - } else if (CPU == "cortex-m3" || CPU == "cortex-m4") { + } else if (CPU == "cortex-m3" || CPU == "cortex-m4" || CPU == "cortex-m7") { Features["hwdiv"] = true; } } @@ -4017,7 +4017,7 @@ .Case("swift", "7S") .Case("cyclone", "8A") .Case("cortex-m3", "7M") - .Case("cortex-m4", "7EM") + .Cases("cortex-m4", "cortex-m7", "7EM") .Case("cortex-m0", "6M") .Cases("cortex-a53", "cortex-a57", "8A") .Default(nullptr); @@ -4027,7 +4027,7 @@ .Cases("cortex-a5", "cortex-a7", "cortex-a8", "A") .Cases("cortex-a9", "cortex-a12", "cortex-a15", "krait", "A") .Cases("cortex-a53", "cortex-a57", "A") - .Cases("cortex-m3", "cortex-m4", "cortex-m0", "M") + .Cases("cortex-m3", "cortex-m4", "cortex-m0", "cortex-m7", "M") .Cases("cortex-r4", "cortex-r5", "R") .Default(""); } Index: lib/Driver/ToolChains.cpp =================================================================== --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -137,7 +137,7 @@ .Cases("cortex-a9", "cortex-a12", "cortex-a15", "krait", "armv7") .Cases("cortex-r4", "cortex-r5", "armv7r") .Case("cortex-m3", "armv7m") - .Case("cortex-m4", "armv7em") + .Cases("cortex-m4", "cortex-m7", "armv7em") .Case("swift", "armv7s") .Default(nullptr); } Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -544,6 +544,18 @@ Features.push_back("+d16"); Features.push_back("+fp-only-sp"); Features.push_back("-neon"); + } else if (FPU == "fp5-sp-d16" || FPU == "fpv5-sp-d16") { + Features.push_back("+fp-armv8"); + Features.push_back("+fp-only-sp"); + Features.push_back("+d16"); + Features.push_back("-neon"); + Features.push_back("-crypto"); + } else if (FPU == "fp5-dp-d16" || FPU == "fpv5-dp-d16" || + FPU == "fp5-d16" || FPU == "fpv5-d16") { + Features.push_back("+fp-armv8"); + Features.push_back("+d16"); + Features.push_back("-neon"); + Features.push_back("-crypto"); } else if (FPU == "fp-armv8") { Features.push_back("+fp-armv8"); Features.push_back("-neon"); @@ -5336,7 +5348,7 @@ .Cases("cortex-r4", "cortex-r5", "v7r") .Case("cortex-m0", "v6m") .Case("cortex-m3", "v7m") - .Case("cortex-m4", "v7em") + .Cases("cortex-m4", "cortex-m7", "v7em") .Case("swift", "v7s") .Case("cyclone", "v8") .Cases("cortex-a53", "cortex-a57", "v8") Index: test/Driver/arm-cortex-cpus.c =================================================================== --- test/Driver/arm-cortex-cpus.c +++ test/Driver/arm-cortex-cpus.c @@ -231,11 +231,15 @@ // CHECK-BE-CPUV7M: "-cc1"{{.*}} "-triple" "thumbebv7m-{{.*}} // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7EM %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7EM %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m4 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7EM %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m7 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7EM %s // CHECK-CPUV7EM: "-cc1"{{.*}} "-triple" "thumbv7em-{{.*}} // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-m4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7EM %s +// RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-m7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7EM %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m4 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7EM %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m7 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7EM %s // CHECK-BE-CPUV7EM: "-cc1"{{.*}} "-triple" "thumbebv7em-{{.*}} // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s Index: test/Driver/arm-mfpu.c =================================================================== --- test/Driver/arm-mfpu.c +++ test/Driver/arm-mfpu.c @@ -63,6 +63,25 @@ // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp" // CHECK-FP4-SP-D16: "-target-feature" "-neon" +// RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s +// RUN: %clang -target arm-linux-eabi -mfpu=fpv5-sp-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s +// CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8" +// CHECK-FP5-SP-D16: "-target-feature" "+fp-only-sp" +// CHECK-FP5-SP-D16: "-target-feature" "+d16" +// CHECK-FP5-SP-D16: "-target-feature" "-neon" +// CHECK-FP5-SP-D16: "-target-feature" "-crypto" + +// RUN: %clang -target arm-linux-eabi -mfpu=fp5-dp-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s +// RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s +// CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8" +// CHECK-FP5-DP-D16: "-target-feature" "+d16" +// CHECK-FP5-DP-D16: "-target-feature" "-neon" +// CHECK-FP5-DP-D16: "-target-feature" "-crypto" + // RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NEON %s // CHECK-NEON: "-target-feature" "+neon" Index: test/Preprocessor/arm-target-features.c =================================================================== --- test/Preprocessor/arm-target-features.c +++ test/Preprocessor/arm-target-features.c @@ -240,6 +240,10 @@ // RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck --check-prefix=M4-THUMB %s // M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 +// Test whether predefines are as expected when targeting cortex-m7. +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck --check-prefix=M7-THUMB %s +// M7-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + // Test whether predefines are as expected when targeting krait. // RUN: %clang -target armv7 -mcpu=krait -x c -E -dM %s -o - | FileCheck --check-prefix=KRAIT-ARM %s // KRAIT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1