File tree Expand file tree Collapse file tree 1 file changed +5
-16
lines changed Expand file tree Collapse file tree 1 file changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -91,23 +91,12 @@ IntegerType IntegerType::scaleElementBitwidth(unsigned scale) {
91
91
// ===----------------------------------------------------------------------===//
92
92
93
93
unsigned FloatType::getWidth () {
94
- if (llvm::isa<Float6E3M2FNType>(*this ))
95
- return 6 ;
96
- if (llvm::isa<Float8E5M2Type, Float8E4M3Type, Float8E4M3FNType,
97
- Float8E5M2FNUZType, Float8E4M3FNUZType, Float8E4M3B11FNUZType,
98
- Float8E3M4Type>(*this ))
99
- return 8 ;
100
- if (llvm::isa<Float16Type, BFloat16Type>(*this ))
101
- return 16 ;
102
- 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 ))
103
98
return 32 ;
104
- if (llvm::isa<Float64Type>(*this ))
105
- return 64 ;
106
- if (llvm::isa<Float80Type>(*this ))
107
- return 80 ;
108
- if (llvm::isa<Float128Type>(*this ))
109
- return 128 ;
110
- llvm_unreachable (" unexpected float type" );
99
+ return APFloat::semanticsSizeInBits (getFloatSemantics ());
111
100
}
112
101
113
102
// / Returns the floating semantics for the given type.
You can’t perform that action at this time.
0 commit comments