diff options
author | Scott Egerton <scott.egerton@embecosm.com> | 2020-01-14 17:45:45 +0000 |
---|---|---|
committer | Scott Egerton <scott.egerton@embecosm.com> | 2020-01-14 17:45:45 +0000 |
commit | 57cf6ee9c84434161088c39a6f8dd2aae14eb12d (patch) | |
tree | 98f41c17c14b693758a144e55e3242fe39b1815a /clang/lib/Basic | |
parent | fd19ffc6a502f8e647696d550abb04a6c8c1b182 (diff) | |
download | bcm5719-llvm-57cf6ee9c84434161088c39a6f8dd2aae14eb12d.tar.gz bcm5719-llvm-57cf6ee9c84434161088c39a6f8dd2aae14eb12d.zip |
[RISCV] Add Clang frontend support for Bitmanip extension
Summary: This adds the __riscv_bitmanip macro and the 'b' target feature to enable it.
Reviewers: asb, simoncook, lewis-revill, PaoloS, lenary
Reviewed By: lenary
Subscribers: Jim, rbar, johnrusso, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71553
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r-- | clang/lib/Basic/Targets/RISCV.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Basic/Targets/RISCV.h | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index ab8272c034f..58285f1d813 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -125,6 +125,10 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, if (HasC) Builder.defineMacro("__riscv_compressed"); + + if (HasB) { + Builder.defineMacro("__riscv_bitmanip"); + } } /// Return true if has this feature, need to sync with handleTargetFeatures. @@ -139,6 +143,7 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const { .Case("f", HasF) .Case("d", HasD) .Case("c", HasC) + .Case("b", HasB) .Default(false); } @@ -156,6 +161,8 @@ bool RISCVTargetInfo::handleTargetFeatures(std::vector<std::string> &Features, HasD = true; else if (Feature == "+c") HasC = true; + else if (Feature == "+b") + HasB = true; } return true; diff --git a/clang/lib/Basic/Targets/RISCV.h b/clang/lib/Basic/Targets/RISCV.h index 9118494a87a..05da13230bf 100644 --- a/clang/lib/Basic/Targets/RISCV.h +++ b/clang/lib/Basic/Targets/RISCV.h @@ -30,11 +30,12 @@ protected: bool HasF; bool HasD; bool HasC; + bool HasB; public: RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &) : TargetInfo(Triple), HasM(false), HasA(false), HasF(false), - HasD(false), HasC(false) { + HasD(false), HasC(false), HasB(false) { LongDoubleWidth = 128; LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); |