Skip to content

Commit 20e5fc1

Browse files
committed
Replace isSigned()
1 parent 850b7c0 commit 20e5fc1

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

clang/utils/TableGen/SveEmitter.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class SVEType {
8787
bool isPointer() const { return Pointer; }
8888
bool isConstant() const { return Constant; }
8989
bool isImmediate() const { return Immediate; }
90-
bool isSigned() const { return Kind != UInt; }
9190
bool isScalar() const { return NumVectors == 0; }
9291
bool isVector() const { return NumVectors > 0; }
9392
bool isScalableVector() const { return isVector() && IsScalable; }
@@ -98,11 +97,12 @@ class SVEType {
9897
bool isFloat() const { return Kind == Float; }
9998
bool isBFloat() const { return Kind == BFloat16; }
10099
bool isMFloat() const { return Kind == MFloat8; }
101-
bool isTypedPointer() const { return Pointer && Kind != Void; }
102100
bool isFloatingPoint() const {
103101
return Kind == Float || Kind == BFloat16 || Kind == MFloat8;
104102
}
105103
bool isInteger() const { return Kind == SInt || Kind == UInt; }
104+
bool isSignedInteger() const { return Kind == SInt; }
105+
bool isUnsignedInteger() const { return Kind == UInt; }
106106
bool isScalarPredicate() const {
107107
return Kind == Predicate && NumVectors == 0;
108108
}
@@ -491,13 +491,11 @@ std::string SVEType::builtin_str() const {
491491
}
492492
}
493493

494-
// Make chars and typed pointers explicitly signed.
495-
if (!isFloatingPoint() && !isVoid()) {
496-
if ((ElementBitwidth == 8 || isPointer()) && isSigned())
497-
OutStr = "S" + OutStr;
498-
if (!isSigned())
499-
OutStr = "U" + OutStr;
500-
}
494+
// Make chars and integer pointers explicitly signed.
495+
if((ElementBitwidth == 8 || isPointer()) && isSignedInteger())
496+
OutStr = "S" + OutStr;
497+
else if(isUnsignedInteger())
498+
OutStr = "U" + OutStr;
501499

502500
// Constant indices are "int", but have the "constant expression" modifier.
503501
if (isImmediate()) {
@@ -544,12 +542,10 @@ std::string SVEType::str() const {
544542
S += "bfloat";
545543
else if (isMFloat())
546544
S += "mfloat";
547-
else {
548-
if (isSigned())
549-
S += "int";
550-
else
551-
S += "uint";
552-
};
545+
else if (isSignedInteger())
546+
S += "int";
547+
else if (isUnsignedInteger())
548+
S += "uint";
553549

554550
if (!isPredicate() && !isSvcount())
555551
S += utostr(ElementBitwidth);
@@ -1008,8 +1004,11 @@ std::string Intrinsic::replaceTemplatedArgs(std::string Name, TypeSpec TS,
10081004

10091005
// Replace templated arg with the right suffix (e.g. u32)
10101006
std::string TypeCode;
1011-
if (T.isInteger())
1012-
TypeCode = T.isSigned() ? 's' : 'u';
1007+
1008+
if(T.isSignedInteger())
1009+
TypeCode = 's';
1010+
else if (T.isUnsignedInteger())
1011+
TypeCode = 'u';
10131012
else if (T.isSvcount())
10141013
TypeCode = 'c';
10151014
else if (T.isPredicate())

0 commit comments

Comments
 (0)