================ @@ -423,131 +434,143 @@ const std::array<SVEEmitter::ReinterpretTypeInfo, 12> SVEEmitter::Reinterprets = // Type implementation //===----------------------------------------------------------------------===// -std::string SVEType::builtin_str() const { - std::string S; - if (isVoid()) +std::string SVEType::builtinBaseType() const { + switch (Kind) { + case TypeKind::Void: return "v"; - - if (isScalarPredicate()) - return "b"; - - if (isSvcount()) + case TypeKind::Svcount: return "Qa"; - - if (isVoidPointer()) - S += "v"; - else if (!isFloatingPoint()) + case TypeKind::BFloat16: + assert(ElementBitwidth == 16 && "Invalid BFloat16!"); + return "y"; + case TypeKind::MFloat8: + assert(ElementBitwidth == 8 && "Invalid MFloat8!"); + return "c"; + case TypeKind::Float: switch (ElementBitwidth) { - case 1: S += "b"; break; - case 8: S += "c"; break; - case 16: S += "s"; break; - case 32: S += "i"; break; - case 64: S += "Wi"; break; - case 128: S += "LLLi"; break; - default: llvm_unreachable("Unhandled case!"); + case 16: + return "h"; + case 32: + return "f"; + case 64: + return "d"; + default: + llvm_unreachable("Unhandled float width!"); } - else if (isFloat()) + case TypeKind::Predicate: + if (isScalar()) + return "b"; + [[fallthrough]]; + // SInt/UInt, PredicatePattern, PrefetchOp. + default: switch (ElementBitwidth) { - case 16: S += "h"; break; - case 32: S += "f"; break; - case 64: S += "d"; break; - default: llvm_unreachable("Unhandled case!"); + case 1: + return "b"; + case 8: + return "c"; + case 16: + return "s"; + case 32: + return "i"; + case 64: + return "Wi"; + case 128: + return "LLLi"; + default: + llvm_unreachable("Unhandled bitwidth!"); } - else if (isBFloat()) { - assert(ElementBitwidth == 16 && "Not a valid BFloat."); - S += "y"; - } else if (isMFloat()) { - assert(ElementBitwidth == 8 && "Not a valid MFloat."); - S += "m"; } +} - if (!isFloatingPoint()) { - if ((isChar() || isPointer()) && !isVoidPointer()) { - // Make chars and typed pointers explicitly signed. - if (Signed) - S = "S" + S; - else if (!Signed) - S = "U" + S; - } else if (!isVoidPointer() && !Signed) { - S = "U" + S; - } - } +std::string SVEType::builtin_str() const { - // Constant indices are "int", but have the "constant expression" modifier. - if (isImmediate()) { - assert(!isFloat() && "fp immediates are not supported"); - S = "I" + S; - } + std::string Prefix; - if (isScalar()) { - if (Constant) S += "C"; - if (Pointer) S += "*"; - return S; + if (isScalableVector()) + Prefix = "q" + llvm::utostr(getNumElements() * NumVectors); + else if (isFixedLengthVector()) + Prefix = "V" + llvm::utostr(getNumElements() * NumVectors); + else if (isImmediate()) { + assert(!isFloatingPoint() && "fp immediates are not supported"); + Prefix = "I"; } - if (isFixedLengthVector()) - return "V" + utostr(getNumElements() * NumVectors) + S; - return "q" + utostr(getNumElements() * NumVectors) + S; + // Make chars and integer pointers explicitly signed. + if ((ElementBitwidth == 8 || isPointer()) && isSignedInteger()) ---------------- SpencerAbson wrote:
Before this patch, the code that performed `// Make chars explicitly typed` deduced that a type was a `char` from `!isFloatingPoint()` and `ElementBitWidth == 8`. One effect of this is that the builtin string for a the type `Pc` would be `q16Sc` (vector of signed chars). The change that I have made here will ignore sign information for predicates. @sdesmalen-arm do you know if this was the intent of the original code? https://github.com/llvm/llvm-project/pull/117717 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits