diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-01-11 11:21:31 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-01-11 11:21:31 +0000 |
| commit | 48af2a9e662f0d7ad0b6faa5cc9b25365cb21197 (patch) | |
| tree | 908809555f94b52270db629bcf3007631419999a | |
| parent | 3eacfb83fa60e03e57a943250d97fb4c13567dcb (diff) | |
| download | bcm5719-llvm-48af2a9e662f0d7ad0b6faa5cc9b25365cb21197.tar.gz bcm5719-llvm-48af2a9e662f0d7ad0b6faa5cc9b25365cb21197.zip | |
Fix -mfpu parsing on ARM.
- Support gcc-compatible vfpv3 name in addition to vfp3.
- Support vfpv3-d16.
- Disable neon feature for -mfpu=vfp* (yes, we were emitting Neon instructions
for those!).
llvm-svn: 147943
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 13 | ||||
| -rw-r--r-- | clang/test/Driver/arm-mfpu.c | 36 |
3 files changed, 49 insertions, 2 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 8ec9f1c0aba..f3d5550bb6a 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -2658,7 +2658,7 @@ public: const std::string &Name, bool Enabled) const { if (Name == "soft-float" || Name == "soft-float-abi" || - Name == "vfp2" || Name == "vfp3" || Name == "neon") { + Name == "vfp2" || Name == "vfp3" || Name == "neon" || Name == "d16") { Features[Name] = Enabled; } else return false; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index a241712da96..1edc4414964 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -660,12 +660,23 @@ void Clang::AddARMTargetArgs(const ArgList &Args, CmdArgs.push_back("-vfp3"); CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-neon"); + } else if (FPU == "vfp3-d16" || FPU == "vfpv3-d16") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+vfp3"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+d16"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); } else if (FPU == "vfp") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+vfp2"); - } else if (FPU == "vfp3") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); + } else if (FPU == "vfp3" || FPU == "vfpv3") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+vfp3"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); } else if (FPU == "neon") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+neon"); diff --git a/clang/test/Driver/arm-mfpu.c b/clang/test/Driver/arm-mfpu.c new file mode 100644 index 00000000000..41c67578dfb --- /dev/null +++ b/clang/test/Driver/arm-mfpu.c @@ -0,0 +1,36 @@ +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=fpa %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FPA %s +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=fpe2 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FPA %s +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=fpe3 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FPA %s +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=maverick %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-FPA %s +// CHECK-FPA: "-target-feature" "-vfp2" +// CHECK-FPA: "-target-feature" "-vfp3" +// CHECK-FPA: "-target-feature" "-neon" + +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s +// CHECK-VFP3-D16: "-target-feature" "+vfp3" +// CHECK-VFP3-D16: "-target-feature" "+d16" +// CHECK-VFP3-D16: "-target-feature" "-neon" + +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP %s +// CHECK-VFP: "-target-feature" "+vfp2" +// CHECK-VFP: "-target-feature" "-neon" + +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=vfp3 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3 %s +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3 %s +// CHECK-VFP3: "-target-feature" "+vfp3" +// CHECK-VFP3: "-target-feature" "-neon" + +// RUN: %clang -ccc-host-triple arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NEON %s +// CHECK-NEON: "-target-feature" "+neon" + |

