File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -91,21 +91,12 @@ IntegerType IntegerType::scaleElementBitwidth(unsigned scale) {
91
91
// ===----------------------------------------------------------------------===//
92
92
93
93
unsigned FloatType::getWidth () {
94
- if (llvm::isa<Float8E5M2Type, Float8E4M3Type, Float8E4M3FNType,
95
- Float8E5M2FNUZType, Float8E4M3FNUZType, Float8E4M3B11FNUZType,
96
- Float8E3M4Type>(*this ))
97
- return 8 ;
98
- if (llvm::isa<Float16Type, BFloat16Type>(*this ))
99
- return 16 ;
100
- if (llvm::isa<Float32Type, FloatTF32Type>(*this ))
94
+ // The actual width of TF32 is 19 bits. However, since it is a truncated
95
+ // version of Float32, we treat it as 32 bits in MLIR FloatType::getWidth
96
+ // for compatibility.
97
+ if (llvm::isa<FloatTF32Type>(*this ))
101
98
return 32 ;
102
- if (llvm::isa<Float64Type>(*this ))
103
- return 64 ;
104
- if (llvm::isa<Float80Type>(*this ))
105
- return 80 ;
106
- if (llvm::isa<Float128Type>(*this ))
107
- return 128 ;
108
- llvm_unreachable (" unexpected float type" );
99
+ return APFloat::semanticsSizeInBits (getFloatSemantics ());
109
100
}
110
101
111
102
// / Returns the floating semantics for the given type.
You can’t perform that action at this time.
0 commit comments