diff options
author | Simon Tatham <simon.tatham@arm.com> | 2019-11-04 12:40:25 +0000 |
---|---|---|
committer | Simon Tatham <simon.tatham@arm.com> | 2019-11-06 09:01:42 +0000 |
commit | f0c6890f32c0d5ee7f3973181eb83fcb0a50dc1a (patch) | |
tree | 811343cf6055c265db6eeaa220a9819848405c53 /clang/utils/TableGen/MveEmitter.cpp | |
parent | 26bc7cb05edd6bea4b9a1593baf0fbe9e45f54e4 (diff) | |
download | bcm5719-llvm-f0c6890f32c0d5ee7f3973181eb83fcb0a50dc1a.tar.gz bcm5719-llvm-f0c6890f32c0d5ee7f3973181eb83fcb0a50dc1a.zip |
[ARM,MVE] Integer-type nitpicks in MVE intrinsics.
A few integer types in the ACLE definitions of MVE intrinsics are
given as 'int' or 'unsigned' instead of <stdint.h> fixed-size types
like uint32_t. Usually these are the ones where the size isn't that
important, such as immediate offsets in loads (which have a range
limited by the instruction encoding) or the carry flag in vadcq which
can only be 0 or 1 anyway.
With this change, <arm_mve.h> follows that exact type naming, so that
the function prototypes look identical to the ones in ACLE, instead of
replacing int and unsigned with int32_t and uint32_t.
Reviewers: dmgreen
Subscribers: kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69790
Diffstat (limited to 'clang/utils/TableGen/MveEmitter.cpp')
-rw-r--r-- | clang/utils/TableGen/MveEmitter.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/utils/TableGen/MveEmitter.cpp b/clang/utils/TableGen/MveEmitter.cpp index 1f9752261fb..ddec171d671 100644 --- a/clang/utils/TableGen/MveEmitter.cpp +++ b/clang/utils/TableGen/MveEmitter.cpp @@ -229,6 +229,7 @@ public: class ScalarType : public CRegularNamedType { ScalarTypeKind Kind; unsigned Bits; + std::string NameOverride; public: ScalarType(const Record *Record) : CRegularNamedType(TypeKind::Scalar) { @@ -237,6 +238,7 @@ public: .Case("u", ScalarTypeKind::UnsignedInt) .Case("f", ScalarTypeKind::Float); Bits = Record->getValueAsInt("size"); + NameOverride = Record->getValueAsString("nameOverride"); } unsigned sizeInBits() const override { return Bits; } ScalarTypeKind kind() const { return Kind; } @@ -244,6 +246,11 @@ public: std::string cNameBase() const override { return toCPrefix(Kind) + utostr(Bits); } + std::string cName() const override { + if (NameOverride.empty()) + return CRegularNamedType::cName(); + return NameOverride; + } std::string llvmName() const override { if (Kind == ScalarTypeKind::Float) { if (Bits == 16) @@ -261,6 +268,7 @@ public: } bool isInteger() const { return Kind != ScalarTypeKind::Float; } bool requiresFloat() const override { return !isInteger(); } + bool hasNonstandardName() const { return !NameOverride.empty(); } static bool classof(const Type *T) { return T->typeKind() == TypeKind::Scalar; @@ -1263,6 +1271,8 @@ void MveEmitter::EmitHeader(raw_ostream &OS) { "typedef float float32_t;\n"; for (const auto &kv : ScalarTypes) { const ScalarType *ST = kv.second.get(); + if (ST->hasNonstandardName()) + continue; raw_ostream &OS = parts[ST->requiresFloat() ? Float : 0]; const VectorType *VT = getVectorType(ST); |