Skip to content

Commit 6288a81

Browse files
committed
Fix improper predicate builtin strings
1 parent a9f0e6f commit 6288a81

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

clang/utils/TableGen/SveEmitter.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class SVEType {
116116

117117
unsigned getNumElements() const {
118118
assert(ElementBitwidth != ~0U);
119-
return Bitwidth / ElementBitwidth;
119+
return isPredicate() ? 16 : (Bitwidth / ElementBitwidth);
120120
}
121121
unsigned getSizeInBits() const {
122122
return Bitwidth;
@@ -137,7 +137,7 @@ class SVEType {
137137
/// Applies a prototype modifier to the type.
138138
void applyModifier(char Mod);
139139

140-
/// Get the builtin base for this SVEType, e.g, 'Wi' for svint64_t.
140+
/// Get the builtin base for this SVEType, e.g. 'Wi' for svint64_t.
141141
std::string builtinBaseType() const;
142142
};
143143

@@ -442,6 +442,11 @@ std::string SVEType::builtinBaseType() const {
442442
return "v";
443443
case TypeKind::Svcount:
444444
return "Qa";
445+
case TypeKind::PrefetchOp:
446+
case TypeKind::PredicatePattern:
447+
return "i";
448+
case TypeKind::Predicate:
449+
return "b";
445450
case TypeKind::BFloat16:
446451
assert(ElementBitwidth == 16 && "Invalid BFloat16!");
447452
return "y";
@@ -459,11 +464,8 @@ std::string SVEType::builtinBaseType() const {
459464
default:
460465
llvm_unreachable("Unhandled float width!");
461466
}
462-
case TypeKind::Predicate:
463-
if (isScalar())
464-
return "b";
465-
[[fallthrough]];
466-
// SInt/UInt, PredicatePattern, PrefetchOp.
467+
case TypeKind::SInt:
468+
case TypeKind::UInt:
467469
default:
468470
switch (ElementBitwidth) {
469471
case 1:
@@ -482,10 +484,10 @@ std::string SVEType::builtinBaseType() const {
482484
llvm_unreachable("Unhandled bitwidth!");
483485
}
484486
}
487+
llvm_unreachable("Unhandled TypeKind!");
485488
}
486489

487490
std::string SVEType::builtin_str() const {
488-
489491
std::string Prefix;
490492

491493
if (isScalableVector())

0 commit comments

Comments
 (0)