diff options
| author | Tim Northover <tnorthover@apple.com> | 2013-08-01 09:23:19 +0000 |
|---|---|---|
| committer | Tim Northover <tnorthover@apple.com> | 2013-08-01 09:23:19 +0000 |
| commit | 2fe823a6c39b332b1a38ab22ab1f88b5dc580090 (patch) | |
| tree | ba976de785979cb7cf12a02b26fcecd966cd8856 /clang/lib/Basic/Targets.cpp | |
| parent | 40e9efd725d12b4d9d8d6480b64ae8442db5f28e (diff) | |
| download | bcm5719-llvm-2fe823a6c39b332b1a38ab22ab1f88b5dc580090.tar.gz bcm5719-llvm-2fe823a6c39b332b1a38ab22ab1f88b5dc580090.zip | |
AArch64: initial NEON support
Patch by Ana Pazos
- Completed implementation of instruction formats:
AdvSIMD three same
AdvSIMD modified immediate
AdvSIMD scalar pairwise
- Completed implementation of instruction classes
(some of the instructions in these classes
belong to yet unfinished instruction formats):
Vector Arithmetic
Vector Immediate
Vector Pairwise Arithmetic
- Initial implementation of instruction formats:
AdvSIMD scalar two-reg misc
AdvSIMD scalar three same
- Intial implementation of instruction class:
Scalar Arithmetic
- Initial clang changes to support arm v8 intrinsics.
Note: no clang changes for scalar intrinsics function name mangling yet.
- Comprehensive test cases for added instructions
To verify auto codegen, encoding, decoding, diagnosis, intrinsics.
llvm-svn: 187568
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 596eb8cb168..718f3bb223a 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3177,7 +3177,14 @@ class AArch64TargetInfo : public TargetInfo { static const char * const GCCRegNames[]; static const TargetInfo::GCCRegAlias GCCRegAliases[]; + enum FPUModeEnum { + FPUMode, + NeonMode + }; + + unsigned FPU; static const Builtin::Info BuiltinInfo[]; + public: AArch64TargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) { BigEndian = false; @@ -3242,7 +3249,14 @@ public: Opts.ShortEnums ? "1" : "4"); if (BigEndian) - Builder.defineMacro("__ARM_BIG_ENDIAN"); + Builder.defineMacro("__AARCH_BIG_ENDIAN"); + + if (FPU == NeonMode) { + Builder.defineMacro("__AARCH_FEATURE_ADVSIMD"); + + // 64-bit NEON supports half, single and double precision operations. + Builder.defineMacro("__AARCH_ADVSIMD_FP", "0xe"); + } } virtual void getTargetBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) const { @@ -3250,9 +3264,28 @@ public: NumRecords = clang::AArch64::LastTSBuiltin-Builtin::FirstTSBuiltin; } virtual bool hasFeature(StringRef Feature) const { - return Feature == "aarch64"; + return Feature == "aarch64" || (Feature == "neon" && FPU == NeonMode); } - virtual void getGCCRegNames(const char * const *&Names, + + virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features, + StringRef Name, bool Enabled) const { + if (Name == "neon") { + Features[Name] = Enabled; + return true; + } + + return false; + } + + virtual void HandleTargetFeatures(std::vector<std::string> &Features) { + FPU = FPUMode; + for (unsigned i = 0, e = Features.size(); i != e; ++i) { + if (Features[i] == "+neon") + FPU = NeonMode; + } + } + + virtual void getGCCRegNames(const char *const *&Names, unsigned &NumNames) const; virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, unsigned &NumAliases) const; |

