Skip to content

Commit a50d31c

Browse files
committed
plain enum
1 parent e44b3e8 commit a50d31c

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

mlir/include/mlir/Dialect/Arith/IR/ArithBase.td

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,17 @@ def Arith_RoundingModeAttr : I32EnumAttr<
191191

192192
// The default mode. Denormals are preserved and processed as defined
193193
// by IEEE 754 rules.
194-
def Arith_DenormalModeIEEE : I32BitEnumAttrCaseNone<"ieee">;
194+
def Arith_DenormalModeIEEE : I32EnumAttrCase<"ieee", 0>;
195195

196196
// A mode where denormal numbers are flushed to zero, but the sign of the zero
197197
// (+0 or -0) is preserved.
198-
def Arith_DenormalModePreserveSign : I32BitEnumAttrCase<"preserve_sign", 1>;
198+
def Arith_DenormalModePreserveSign : I32EnumAttrCase<"preserve_sign", 1>;
199199

200200
// A mode where all denormal numbers are flushed to positive zero (+0),
201201
// ignoring the sign of the original number.
202-
def Arith_DenormalModePositiveZero : I32BitEnumAttrCase<"positive_zero", 2>;
202+
def Arith_DenormalModePositiveZero : I32EnumAttrCase<"positive_zero", 2>;
203203

204-
def Arith_DenormalMode : I32BitEnumAttr<
204+
def Arith_DenormalMode : I32EnumAttr<
205205
"DenormalMode", "denormal mode arith",
206206
[Arith_DenormalModeIEEE, Arith_DenormalModePreserveSign,
207207
Arith_DenormalModePositiveZero]> {
@@ -212,7 +212,6 @@ def Arith_DenormalMode : I32BitEnumAttr<
212212
def Arith_DenormalModeAttr :
213213
EnumAttr<Arith_Dialect, Arith_DenormalMode, "denormal"> {
214214
let assemblyFormat = "`<` $value `>`";
215-
let genVerifyDecl = 1;
216215
}
217216

218217
#endif // ARITH_BASE

mlir/lib/Dialect/Arith/IR/ArithOps.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,20 +2643,6 @@ Value mlir::arith::getReductionOp(AtomicRMWKind op, OpBuilder &builder,
26432643
return nullptr;
26442644
}
26452645

2646-
//===----------------------------------------------------------------------===//
2647-
// DenormalModeAttr
2648-
//===----------------------------------------------------------------------===//
2649-
2650-
LogicalResult DenormalModeAttr::verify(
2651-
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
2652-
DenormalMode mode) {
2653-
auto value = static_cast<uint32_t>(mode);
2654-
bool isSingleBitSet = (value & (value - 1)) == 0;
2655-
if (!isSingleBitSet)
2656-
return emitError() << "expected only a single denormal mode";
2657-
return success();
2658-
}
2659-
26602646
//===----------------------------------------------------------------------===//
26612647
// TableGen'd op method definitions
26622648
//===----------------------------------------------------------------------===//

mlir/test/Dialect/Arith/invalid.mlir

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -853,11 +853,3 @@ func.func @select_tensor_encoding(
853853
%0 = arith.select %arg0, %arg1, %arg2 : tensor<8xi1, "bar">, tensor<8xi32, "foo">
854854
return %0 : tensor<8xi32, "foo">
855855
}
856-
857-
// -----
858-
859-
func.func @test_denormal_mode(%arg0: f32, %arg1: f32) -> f32 {
860-
// expected-error @below{{expected only a single denormal mode}}
861-
%0 = arith.subf %arg0, %arg1 denormal<preserve_sign | positive_zero> : f32
862-
return %0 : f32
863-
}

0 commit comments

Comments
 (0)