@@ -240,6 +240,16 @@ def StableHLO_CbrtOp: StableHLO_UnaryElementwiseOp<"cbrt",
240240 %result = stablehlo.cbrt %operand : tensor<4xf64>
241241 ```
242242 }];
243+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
244+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
245+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
246+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
247+ let hasVerifier = 1;
248+
249+ let assemblyFormat = [{
250+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
251+ }];
252+
243253}
244254
245255def StableHLO_CeilOp: StableHLO_UnaryElementwiseOp<"ceil",
@@ -310,6 +320,15 @@ def StableHLO_CosineOp: StableHLO_UnaryElementwiseOp<"cosine",
310320 %result = stablehlo.cosine %operand : tensor<2xf32>
311321 ```
312322 }];
323+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
324+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
325+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
326+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
327+ let hasVerifier = 1;
328+
329+ let assemblyFormat = [{
330+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
331+ }];
313332}
314333
315334def StableHLO_ExpOp: StableHLO_UnaryElementwiseOp<"exponential",
@@ -329,17 +348,9 @@ def StableHLO_ExpOp: StableHLO_UnaryElementwiseOp<"exponential",
329348 ```
330349 }];
331350 let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
332- DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr, "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
351+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
352+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
333353 let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
334- let extraClassDeclaration = commonClassDeclaration # [{
335- LogicalResult reifyReturnTypeShapes(
336- OpBuilder& builder, ValueRange operands,
337- SmallVectorImpl<Value>& reifiedReturnShapes) {
338- return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(),
339- operands.front(),
340- &reifiedReturnShapes);
341- }
342- }];
343354 let hasVerifier = 1;
344355
345356 let assemblyFormat = [{
@@ -363,6 +374,15 @@ def StableHLO_Expm1Op: StableHLO_UnaryElementwiseOp<"exponential_minus_one",
363374 %result = stablehlo.exponential_minus_one %operand : tensor<2xf64>
364375 ```
365376 }];
377+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
378+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
379+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
380+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
381+ let hasVerifier = 1;
382+
383+ let assemblyFormat = [{
384+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
385+ }];
366386}
367387
368388def StableHLO_FloorOp: StableHLO_UnaryElementwiseOp<"floor",
@@ -440,6 +460,15 @@ def StableHLO_LogOp: StableHLO_UnaryElementwiseOp<"log",
440460 %result = stablehlo.log %operand : tensor<2x2xf64>
441461 ```
442462 }];
463+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
464+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
465+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
466+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
467+ let hasVerifier = 1;
468+
469+ let assemblyFormat = [{
470+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
471+ }];
443472}
444473
445474def StableHLO_Log1pOp: StableHLO_UnaryElementwiseOp<"log_plus_one",
@@ -458,6 +487,15 @@ def StableHLO_Log1pOp: StableHLO_UnaryElementwiseOp<"log_plus_one",
458487 %result = stablehlo.log_plus_one %operand : tensor<5xf64>
459488 ```
460489 }];
490+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
491+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
492+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
493+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
494+ let hasVerifier = 1;
495+
496+ let assemblyFormat = [{
497+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
498+ }];
461499}
462500
463501def StableHLO_LogisticOp: StableHLO_UnaryElementwiseOp<"logistic",
@@ -476,6 +514,15 @@ def StableHLO_LogisticOp: StableHLO_UnaryElementwiseOp<"logistic",
476514 %result = stablehlo.logistic %operand : tensor<2x2xf64>
477515 ```
478516 }];
517+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
518+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
519+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
520+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
521+ let hasVerifier = 1;
522+
523+ let assemblyFormat = [{
524+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
525+ }];
479526}
480527
481528def StableHLO_NotOp: StableHLO_UnaryElementwiseOp<"not",
@@ -602,6 +649,15 @@ def StableHLO_RsqrtOp: StableHLO_UnaryElementwiseOp<"rsqrt",
602649 %result = stablehlo.rsqrt %operand : tensor<2x2xf32>
603650 ```
604651 }];
652+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
653+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
654+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
655+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
656+ let hasVerifier = 1;
657+
658+ let assemblyFormat = [{
659+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
660+ }];
605661}
606662
607663def StableHLO_SignOp: StableHLO_UnaryElementwiseOp<"sign",
@@ -637,6 +693,15 @@ def StableHLO_SineOp: StableHLO_UnaryElementwiseOp<"sine",
637693 %result = stablehlo.sine %operand : tensor<2xf32>
638694 ```
639695 }];
696+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
697+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
698+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
699+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
700+ let hasVerifier = 1;
701+
702+ let assemblyFormat = [{
703+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
704+ }];
640705}
641706
642707def StableHLO_SqrtOp: StableHLO_UnaryElementwiseOp<"sqrt",
@@ -655,6 +720,15 @@ def StableHLO_SqrtOp: StableHLO_UnaryElementwiseOp<"sqrt",
655720 %result = stablehlo.sqrt %operand : tensor<2x2xf32>
656721 ```
657722 }];
723+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
724+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
725+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
726+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
727+ let hasVerifier = 1;
728+
729+ let assemblyFormat = [{
730+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
731+ }];
658732}
659733
660734def StableHLO_TanOp: StableHLO_UnaryElementwiseOp<"tan",
@@ -673,6 +747,15 @@ def StableHLO_TanOp: StableHLO_UnaryElementwiseOp<"tan",
673747 %result = stablehlo.tan %operand : tensor<2x2xf64>
674748 ```
675749 }];
750+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
751+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
752+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
753+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
754+ let hasVerifier = 1;
755+
756+ let assemblyFormat = [{
757+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
758+ }];
676759}
677760
678761def StableHLO_TanhOp: StableHLO_UnaryElementwiseOp<"tanh",
@@ -691,6 +774,15 @@ def StableHLO_TanhOp: StableHLO_UnaryElementwiseOp<"tanh",
691774 %result = stablehlo.tanh %operand : tensor<2xf32>
692775 ```
693776 }];
777+ let arguments = (ins HLO_FpComplexOrQuantizedIntTensor:$operand,
778+ DefaultValuedOptionalAttr<StableHLO_ResultAccuracyAttr,
779+ "::mlir::stablehlo::ResultAccuracyMode::DEFAULT">:$result_accuracy);
780+ let results = (outs HLO_FpComplexOrQuantizedIntTensor:$result);
781+ let hasVerifier = 1;
782+
783+ let assemblyFormat = [{
784+ $operand attr-dict `:` custom<SameOperandsAndResultType>(type($operand), type($result))
785+ }];
694786}
695787
696788//===----------------------------------------------------------------------===//
0 commit comments