[MLIR][CHLO] Add legalization for `chlo.polygamma` to MHLO

PiperOrigin-RevId: 357954624
This commit is contained in:
A. Unique TensorFlower 2021-02-17 08:31:46 -08:00 committed by TensorFlow MLIR Team
parent c06de24f6c
commit 220deb3709
5 changed files with 844 additions and 1 deletions

View File

@ -72,6 +72,7 @@ void PopulateForBroadcastingBinaryOp(MLIRContext *context,
POPULATE_BCAST(BroadcastMinOp, mhlo::MinOp); POPULATE_BCAST(BroadcastMinOp, mhlo::MinOp);
POPULATE_BCAST(BroadcastMulOp, mhlo::MulOp); POPULATE_BCAST(BroadcastMulOp, mhlo::MulOp);
POPULATE_BCAST(BroadcastOrOp, mhlo::OrOp); POPULATE_BCAST(BroadcastOrOp, mhlo::OrOp);
POPULATE_BCAST(BroadcastPolygammaOp, PolygammaOp);
POPULATE_BCAST(BroadcastPowOp, mhlo::PowOp); POPULATE_BCAST(BroadcastPowOp, mhlo::PowOp);
POPULATE_BCAST(BroadcastRemOp, mhlo::RemOp); POPULATE_BCAST(BroadcastRemOp, mhlo::RemOp);
POPULATE_BCAST(BroadcastShiftLeftOp, mhlo::ShiftLeftOp); POPULATE_BCAST(BroadcastShiftLeftOp, mhlo::ShiftLeftOp);

View File

@ -894,6 +894,51 @@ Value MaterializeZeta(ConversionPatternRewriter &rewriter, Location loc,
return output; return output;
} }
Value MaterializePolygamma(ConversionPatternRewriter &rewriter, Location loc,
ValueRange args) {
PolygammaOp::Adaptor transformed(args);
Value n = transformed.n();
Value x = transformed.x();
// Handle integer n > 0.
Value one = getConstantLike(rewriter, loc, 1.0, x);
Value two = getConstantLike(rewriter, loc, 2.0, x);
Value sign = rewriter.create<mhlo::SubOp>(
loc,
rewriter.create<mhlo::MulOp>(loc, two,
rewriter.create<mhlo::RemOp>(loc, n, two)),
one);
Value n_plus_one = rewriter.create<mhlo::AddOp>(loc, n, one);
Value exp_lgamma_np1 = rewriter.create<mhlo::ExpOp>(
loc, rewriter.create<chlo::LgammaOp>(loc, n_plus_one));
Value zeta = rewriter.create<chlo::ZetaOp>(loc, n_plus_one, x);
Value result = rewriter.create<mhlo::MulOp>(
loc, rewriter.create<mhlo::MulOp>(loc, sign, exp_lgamma_np1), zeta);
// Handle n = 0.
const StringAttr kEQ = rewriter.getStringAttr(
mhlo::stringifyComparisonDirection(mhlo::ComparisonDirection::EQ));
Value zero = getConstantLike(rewriter, loc, 0.0, x);
Value n_eq_zero = rewriter.create<mhlo::CompareOp>(loc, n, zero, kEQ);
result = rewriter.create<mhlo::SelectOp>(
loc, n_eq_zero, rewriter.create<chlo::DigammaOp>(loc, x), result);
// Check that n is a natural number.
const StringAttr kNE = rewriter.getStringAttr(
mhlo::stringifyComparisonDirection(mhlo::ComparisonDirection::NE));
Value non_int = rewriter.create<mhlo::CompareOp>(
loc, n, rewriter.create<mhlo::FloorOp>(loc, n), kNE);
const StringAttr kLT = rewriter.getStringAttr(
mhlo::stringifyComparisonDirection(mhlo::ComparisonDirection::LT));
Value negative = rewriter.create<mhlo::CompareOp>(loc, n, zero, kLT);
Value non_natural = rewriter.create<mhlo::OrOp>(loc, non_int, negative);
return rewriter.create<mhlo::SelectOp>(
loc, non_natural,
getConstantLike(rewriter, loc, std::numeric_limits<double>::quiet_NaN(),
x),
result);
}
struct ConvertLgammaOp : public OpConversionPattern<LgammaOp> { struct ConvertLgammaOp : public OpConversionPattern<LgammaOp> {
using OpConversionPattern<LgammaOp>::OpConversionPattern; using OpConversionPattern<LgammaOp>::OpConversionPattern;
LogicalResult matchAndRewrite( LogicalResult matchAndRewrite(
@ -920,6 +965,20 @@ struct ConvertDigammaOp : public OpConversionPattern<DigammaOp> {
} }
}; };
struct ConvertPolygammaOp : public OpConversionPattern<PolygammaOp> {
using OpConversionPattern<PolygammaOp>::OpConversionPattern;
LogicalResult matchAndRewrite(
PolygammaOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
Location loc = op.getLoc();
FloatType min_precision_ty = rewriter.getF32Type();
rewriter.replaceOp(
op, MaterializeWithUpcast(rewriter, loc, operands, min_precision_ty,
&MaterializePolygamma));
return success();
}
};
struct ConvertZetaOp : public OpConversionPattern<ZetaOp> { struct ConvertZetaOp : public OpConversionPattern<ZetaOp> {
using OpConversionPattern<ZetaOp>::OpConversionPattern; using OpConversionPattern<ZetaOp>::OpConversionPattern;
LogicalResult matchAndRewrite( LogicalResult matchAndRewrite(
@ -1095,6 +1154,7 @@ void PopulateLegalizeChloToHloPatterns(MLIRContext *context,
ConvertErfOp, ConvertErfOp,
ConvertErfcOp, ConvertErfcOp,
ConvertLgammaOp, ConvertLgammaOp,
ConvertPolygammaOp,
ConvertZetaOp>(context); ConvertZetaOp>(context);
// clang-format on // clang-format on
} }

View File

@ -55,7 +55,7 @@ struct ChloLegalizeToHloPass
if (broadcast_only_) { if (broadcast_only_) {
chlo::PopulateChloBroadcastingPatterns(&getContext(), chlo::PopulateChloBroadcastingPatterns(&getContext(),
&conversionPatterns); &conversionPatterns);
conversionTarget.addLegalOp<chlo::ZetaOp>(); conversionTarget.addLegalOp<chlo::ZetaOp, chlo::PolygammaOp>();
} else { } else {
chlo::PopulateLegalizeChloToHloPatterns(&getContext(), chlo::PopulateLegalizeChloToHloPatterns(&getContext(),
&conversionPatterns); &conversionPatterns);

View File

@ -247,3 +247,14 @@ func @ZetaWithoutBroadcast(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>)
: (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32> : (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>
return %0 : tensor<4xf32> return %0 : tensor<4xf32>
} }
// -----
// CHECK-LABEL: @PolygammaWithoutBroadcast
// CHECK-SAME: (%[[LHS:.*]]: tensor<4xf32>, %[[RHS:.*]]: tensor<4xf32>)
func @PolygammaWithoutBroadcast(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>)
-> tensor<4xf32> {
// CHECK: chlo.polygamma %[[LHS]], %[[RHS]]
%0 = chlo.broadcast_polygamma %arg0, %arg1
: (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>
return %0 : tensor<4xf32>
}

View File

@ -1286,3 +1286,774 @@ func @zeta_f16(%arg0: tensor<f16>, %arg1: tensor<f16>) -> tensor<f16> {
%0 = chlo.zeta %arg0, %arg1 : tensor<f16>, tensor<f16> -> tensor<f16> %0 = chlo.zeta %arg0, %arg1 : tensor<f16>, tensor<f16> -> tensor<f16>
return %0 : tensor<f16> return %0 : tensor<f16>
} }
// CHECK: @polygamma_f32
// CHECK-SAME: (%[[ARG0:.*]]: tensor<f32>, %[[ARG1:.*]]: tensor<f32>)
func @polygamma_f32(%lhs : tensor<f32>, %rhs : tensor<f32>) -> tensor<f32> {
// CHECK: %[[TMP_0:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_1:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_2:.*]] = mhlo.remainder %[[ARG0]], %[[TMP_1]]
// CHECK: %[[TMP_3:.*]] = mhlo.multiply %[[TMP_1]], %[[TMP_2]]
// CHECK: %[[TMP_4:.*]] = mhlo.subtract %[[TMP_3]], %[[TMP_0]]
// CHECK: %[[TMP_5:.*]] = mhlo.add %[[ARG0]], %[[TMP_0]]
// CHECK: %[[TMP_6:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_7:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_6]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_8:.*]] = "mhlo.negate"(%[[TMP_5]])
// CHECK: %[[TMP_9:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_10:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_9]]
// CHECK: %[[TMP_11:.*]] = "mhlo.select"(%[[TMP_7]], %[[TMP_8]], %[[TMP_10]])
// CHECK: %[[TMP_12:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_13:.*]] = mhlo.constant dense<676.520386>
// CHECK: %[[TMP_14:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_15:.*]] = mhlo.add %[[TMP_11]], %[[TMP_14]]
// CHECK: %[[TMP_16:.*]] = mhlo.divide %[[TMP_13]], %[[TMP_15]]
// CHECK: %[[TMP_17:.*]] = mhlo.add %[[TMP_12]], %[[TMP_16]]
// CHECK: %[[TMP_18:.*]] = mhlo.constant dense<-1259.13916>
// CHECK: %[[TMP_19:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_20:.*]] = mhlo.add %[[TMP_11]], %[[TMP_19]]
// CHECK: %[[TMP_21:.*]] = mhlo.divide %[[TMP_18]], %[[TMP_20]]
// CHECK: %[[TMP_22:.*]] = mhlo.add %[[TMP_17]], %[[TMP_21]]
// CHECK: %[[TMP_23:.*]] = mhlo.constant dense<771.323425>
// CHECK: %[[TMP_24:.*]] = mhlo.constant dense<3.000000e+00>
// CHECK: %[[TMP_25:.*]] = mhlo.add %[[TMP_11]], %[[TMP_24]]
// CHECK: %[[TMP_26:.*]] = mhlo.divide %[[TMP_23]], %[[TMP_25]]
// CHECK: %[[TMP_27:.*]] = mhlo.add %[[TMP_22]], %[[TMP_26]]
// CHECK: %[[TMP_28:.*]] = mhlo.constant dense<-176.615036>
// CHECK: %[[TMP_29:.*]] = mhlo.constant dense<4.000000e+00>
// CHECK: %[[TMP_30:.*]] = mhlo.add %[[TMP_11]], %[[TMP_29]]
// CHECK: %[[TMP_31:.*]] = mhlo.divide %[[TMP_28]], %[[TMP_30]]
// CHECK: %[[TMP_32:.*]] = mhlo.add %[[TMP_27]], %[[TMP_31]]
// CHECK: %[[TMP_33:.*]] = mhlo.constant dense<12.5073433>
// CHECK: %[[TMP_34:.*]] = mhlo.constant dense<5.000000e+00>
// CHECK: %[[TMP_35:.*]] = mhlo.add %[[TMP_11]], %[[TMP_34]]
// CHECK: %[[TMP_36:.*]] = mhlo.divide %[[TMP_33]], %[[TMP_35]]
// CHECK: %[[TMP_37:.*]] = mhlo.add %[[TMP_32]], %[[TMP_36]]
// CHECK: %[[TMP_38:.*]] = mhlo.constant dense<-0.138571098>
// CHECK: %[[TMP_39:.*]] = mhlo.constant dense<6.000000e+00>
// CHECK: %[[TMP_40:.*]] = mhlo.add %[[TMP_11]], %[[TMP_39]]
// CHECK: %[[TMP_41:.*]] = mhlo.divide %[[TMP_38]], %[[TMP_40]]
// CHECK: %[[TMP_42:.*]] = mhlo.add %[[TMP_37]], %[[TMP_41]]
// CHECK: %[[TMP_43:.*]] = mhlo.constant dense<9.98436917E-6>
// CHECK: %[[TMP_44:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_45:.*]] = mhlo.add %[[TMP_11]], %[[TMP_44]]
// CHECK: %[[TMP_46:.*]] = mhlo.divide %[[TMP_43]], %[[TMP_45]]
// CHECK: %[[TMP_47:.*]] = mhlo.add %[[TMP_42]], %[[TMP_46]]
// CHECK: %[[TMP_48:.*]] = mhlo.constant dense<1.50563267E-7>
// CHECK: %[[TMP_49:.*]] = mhlo.constant dense<8.000000e+00>
// CHECK: %[[TMP_50:.*]] = mhlo.add %[[TMP_11]], %[[TMP_49]]
// CHECK: %[[TMP_51:.*]] = mhlo.divide %[[TMP_48]], %[[TMP_50]]
// CHECK: %[[TMP_52:.*]] = mhlo.add %[[TMP_47]], %[[TMP_51]]
// CHECK: %[[TMP_53:.*]] = mhlo.constant dense<7.500000e+00>
// CHECK: %[[TMP_54:.*]] = mhlo.add %[[TMP_53]], %[[TMP_11]]
// CHECK: %[[TMP_55:.*]] = mhlo.constant dense<2.01490307>
// CHECK: %[[TMP_56:.*]] = mhlo.divide %[[TMP_11]], %[[TMP_53]]
// CHECK: %[[TMP_57:.*]] = "mhlo.log_plus_one"(%[[TMP_56]])
// CHECK: %[[TMP_58:.*]] = mhlo.add %[[TMP_55]], %[[TMP_57]]
// CHECK: %[[TMP_59:.*]] = mhlo.divide %[[TMP_54]], %[[TMP_58]]
// CHECK: %[[TMP_60:.*]] = mhlo.add %[[TMP_11]], %[[TMP_6]]
// CHECK: %[[TMP_61:.*]] = mhlo.subtract %[[TMP_60]], %[[TMP_59]]
// CHECK: %[[TMP_62:.*]] = mhlo.multiply %[[TMP_61]], %[[TMP_58]]
// CHECK: %[[TMP_63:.*]] = "mhlo.log"(%[[TMP_52]])
// CHECK: %[[TMP_64:.*]] = mhlo.constant dense<0.918938517>
// CHECK: %[[TMP_65:.*]] = mhlo.add %[[TMP_64]], %[[TMP_62]]
// CHECK: %[[TMP_66:.*]] = mhlo.add %[[TMP_65]], %[[TMP_63]]
// CHECK: %[[TMP_67:.*]] = "mhlo.abs"(%[[TMP_5]])
// CHECK: %[[TMP_68:.*]] = "mhlo.floor"(%[[TMP_67]])
// CHECK: %[[TMP_69:.*]] = mhlo.subtract %[[TMP_67]], %[[TMP_68]]
// CHECK: %[[TMP_70:.*]] = "mhlo.compare"(%[[TMP_6]], %[[TMP_69]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_71:.*]] = mhlo.subtract %[[TMP_9]], %[[TMP_69]]
// CHECK: %[[TMP_72:.*]] = "mhlo.select"(%[[TMP_70]], %[[TMP_71]], %[[TMP_69]])
// CHECK: %[[TMP_73:.*]] = mhlo.constant dense<3.14159274>
// CHECK: %[[TMP_74:.*]] = mhlo.multiply %[[TMP_73]], %[[TMP_72]]
// CHECK: %[[TMP_75:.*]] = "mhlo.sine"(%[[TMP_74]])
// CHECK: %[[TMP_76:.*]] = "mhlo.log"(%[[TMP_75]])
// CHECK: %[[TMP_77:.*]] = mhlo.constant dense<1.14472985>
// CHECK: %[[TMP_78:.*]] = mhlo.subtract %[[TMP_77]], %[[TMP_76]]
// CHECK: %[[TMP_79:.*]] = mhlo.subtract %[[TMP_78]], %[[TMP_66]]
// CHECK: %[[TMP_80:.*]] = "mhlo.is_finite"(%[[TMP_76]])
// CHECK: %[[TMP_81:.*]] = "mhlo.negate"(%[[TMP_76]])
// CHECK: %[[TMP_82:.*]] = "mhlo.select"(%[[TMP_80]], %[[TMP_79]], %[[TMP_81]])
// CHECK: %[[TMP_83:.*]] = "mhlo.select"(%[[TMP_7]], %[[TMP_82]], %[[TMP_66]])
// CHECK: %[[TMP_84:.*]] = "mhlo.abs"(%[[TMP_5]])
// CHECK: %[[TMP_85:.*]] = mhlo.constant dense<0x7F800000>
// CHECK: %[[TMP_86:.*]] = "mhlo.compare"(%[[TMP_84]], %[[TMP_85]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_87:.*]] = mhlo.constant dense<0x7F800000>
// CHECK: %[[TMP_88:.*]] = "mhlo.select"(%[[TMP_86]], %[[TMP_87]], %[[TMP_83]])
// CHECK: %[[TMP_89:.*]] = "mhlo.exponential"(%[[TMP_88]])
// CHECK: %[[TMP_90:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_91:.*]] = "mhlo.negate"(%[[TMP_5]])
// CHECK: %[[TMP_92:.*]] = mhlo.power %[[ARG1]], %[[TMP_91]]
// CHECK: %[[TMP_93:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_94:.*]] = mhlo.add %[[ARG1]], %[[TMP_93]]
// CHECK: %[[TMP_95:.*]] = mhlo.power %[[TMP_94]], %[[TMP_91]]
// CHECK: %[[TMP_96:.*]] = mhlo.add %[[TMP_92]], %[[TMP_95]]
// CHECK: %[[TMP_97:.*]] = mhlo.add %[[TMP_94]], %[[TMP_93]]
// CHECK: %[[TMP_98:.*]] = mhlo.power %[[TMP_97]], %[[TMP_91]]
// CHECK: %[[TMP_99:.*]] = mhlo.add %[[TMP_96]], %[[TMP_98]]
// CHECK: %[[TMP_100:.*]] = mhlo.add %[[TMP_97]], %[[TMP_93]]
// CHECK: %[[TMP_101:.*]] = mhlo.power %[[TMP_100]], %[[TMP_91]]
// CHECK: %[[TMP_102:.*]] = mhlo.add %[[TMP_99]], %[[TMP_101]]
// CHECK: %[[TMP_103:.*]] = mhlo.add %[[TMP_100]], %[[TMP_93]]
// CHECK: %[[TMP_104:.*]] = mhlo.power %[[TMP_103]], %[[TMP_91]]
// CHECK: %[[TMP_105:.*]] = mhlo.add %[[TMP_102]], %[[TMP_104]]
// CHECK: %[[TMP_106:.*]] = mhlo.add %[[TMP_103]], %[[TMP_93]]
// CHECK: %[[TMP_107:.*]] = mhlo.power %[[TMP_106]], %[[TMP_91]]
// CHECK: %[[TMP_108:.*]] = mhlo.add %[[TMP_105]], %[[TMP_107]]
// CHECK: %[[TMP_109:.*]] = mhlo.add %[[TMP_106]], %[[TMP_93]]
// CHECK: %[[TMP_110:.*]] = mhlo.power %[[TMP_109]], %[[TMP_91]]
// CHECK: %[[TMP_111:.*]] = mhlo.add %[[TMP_108]], %[[TMP_110]]
// CHECK: %[[TMP_112:.*]] = mhlo.add %[[TMP_109]], %[[TMP_93]]
// CHECK: %[[TMP_113:.*]] = mhlo.power %[[TMP_112]], %[[TMP_91]]
// CHECK: %[[TMP_114:.*]] = mhlo.add %[[TMP_111]], %[[TMP_113]]
// CHECK: %[[TMP_115:.*]] = mhlo.add %[[TMP_112]], %[[TMP_93]]
// CHECK: %[[TMP_116:.*]] = mhlo.power %[[TMP_115]], %[[TMP_91]]
// CHECK: %[[TMP_117:.*]] = mhlo.add %[[TMP_114]], %[[TMP_116]]
// CHECK: %[[TMP_118:.*]] = mhlo.add %[[TMP_115]], %[[TMP_93]]
// CHECK: %[[TMP_119:.*]] = mhlo.power %[[TMP_118]], %[[TMP_91]]
// CHECK: %[[TMP_120:.*]] = mhlo.add %[[TMP_117]], %[[TMP_119]]
// CHECK: %[[TMP_121:.*]] = mhlo.add %[[TMP_118]], %[[TMP_93]]
// CHECK: %[[TMP_122:.*]] = mhlo.power %[[TMP_121]], %[[TMP_91]]
// CHECK: %[[TMP_123:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_124:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_123]]
// CHECK: %[[TMP_125:.*]] = mhlo.multiply %[[TMP_122]], %[[TMP_121]]
// CHECK: %[[TMP_126:.*]] = mhlo.divide %[[TMP_125]], %[[TMP_124]]
// CHECK: %[[TMP_127:.*]] = mhlo.add %[[TMP_120]], %[[TMP_126]]
// CHECK: %[[TMP_128:.*]] = mhlo.multiply %[[TMP_121]], %[[TMP_121]]
// CHECK: %[[TMP_129:.*]] = mhlo.divide %[[TMP_93]], %[[TMP_128]]
// CHECK: %[[TMP_130:.*]] = mhlo.constant dense<2.200000e+01>
// CHECK: %[[TMP_131:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_130]]
// CHECK: %[[TMP_132:.*]] = mhlo.constant dense<2.100000e+01>
// CHECK: %[[TMP_133:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_132]]
// CHECK: %[[TMP_134:.*]] = mhlo.multiply %[[TMP_131]], %[[TMP_133]]
// CHECK: %[[TMP_135:.*]] = mhlo.constant dense<-1.39544646E-19>
// CHECK: %[[TMP_136:.*]] = mhlo.add %[[TMP_90]], %[[TMP_135]]
// CHECK: %[[TMP_137:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_136]]
// CHECK: %[[TMP_138:.*]] = mhlo.multiply %[[TMP_134]], %[[TMP_137]]
// CHECK: %[[TMP_139:.*]] = mhlo.constant dense<2.000000e+01>
// CHECK: %[[TMP_140:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_139]]
// CHECK: %[[TMP_141:.*]] = mhlo.constant dense<1.900000e+01>
// CHECK: %[[TMP_142:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_141]]
// CHECK: %[[TMP_143:.*]] = mhlo.multiply %[[TMP_140]], %[[TMP_142]]
// CHECK: %[[TMP_144:.*]] = mhlo.constant dense<5.50900303E-18>
// CHECK: %[[TMP_145:.*]] = mhlo.add %[[TMP_138]], %[[TMP_144]]
// CHECK: %[[TMP_146:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_145]]
// CHECK: %[[TMP_147:.*]] = mhlo.multiply %[[TMP_143]], %[[TMP_146]]
// CHECK: %[[TMP_148:.*]] = mhlo.constant dense<1.800000e+01>
// CHECK: %[[TMP_149:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_148]]
// CHECK: %[[TMP_150:.*]] = mhlo.constant dense<1.700000e+01>
// CHECK: %[[TMP_151:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_150]]
// CHECK: %[[TMP_152:.*]] = mhlo.multiply %[[TMP_149]], %[[TMP_151]]
// CHECK: %[[TMP_153:.*]] = mhlo.constant dense<-2.17486866E-16>
// CHECK: %[[TMP_154:.*]] = mhlo.add %[[TMP_147]], %[[TMP_153]]
// CHECK: %[[TMP_155:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_154]]
// CHECK: %[[TMP_156:.*]] = mhlo.multiply %[[TMP_152]], %[[TMP_155]]
// CHECK: %[[TMP_157:.*]] = mhlo.constant dense<1.600000e+01>
// CHECK: %[[TMP_158:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_157]]
// CHECK: %[[TMP_159:.*]] = mhlo.constant dense<1.500000e+01>
// CHECK: %[[TMP_160:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_159]]
// CHECK: %[[TMP_161:.*]] = mhlo.multiply %[[TMP_158]], %[[TMP_160]]
// CHECK: %[[TMP_162:.*]] = mhlo.constant dense<8.58606213E-15>
// CHECK: %[[TMP_163:.*]] = mhlo.add %[[TMP_156]], %[[TMP_162]]
// CHECK: %[[TMP_164:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_163]]
// CHECK: %[[TMP_165:.*]] = mhlo.multiply %[[TMP_161]], %[[TMP_164]]
// CHECK: %[[TMP_166:.*]] = mhlo.constant dense<1.400000e+01>
// CHECK: %[[TMP_167:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_166]]
// CHECK: %[[TMP_168:.*]] = mhlo.constant dense<1.300000e+01>
// CHECK: %[[TMP_169:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_168]]
// CHECK: %[[TMP_170:.*]] = mhlo.multiply %[[TMP_167]], %[[TMP_169]]
// CHECK: %[[TMP_171:.*]] = mhlo.constant dense<-3.3896803E-13>
// CHECK: %[[TMP_172:.*]] = mhlo.add %[[TMP_165]], %[[TMP_171]]
// CHECK: %[[TMP_173:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_172]]
// CHECK: %[[TMP_174:.*]] = mhlo.multiply %[[TMP_170]], %[[TMP_173]]
// CHECK: %[[TMP_175:.*]] = mhlo.constant dense<1.200000e+01>
// CHECK: %[[TMP_176:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_175]]
// CHECK: %[[TMP_177:.*]] = mhlo.constant dense<1.100000e+01>
// CHECK: %[[TMP_178:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_177]]
// CHECK: %[[TMP_179:.*]] = mhlo.multiply %[[TMP_176]], %[[TMP_178]]
// CHECK: %[[TMP_180:.*]] = mhlo.constant dense<1.33825364E-11>
// CHECK: %[[TMP_181:.*]] = mhlo.add %[[TMP_174]], %[[TMP_180]]
// CHECK: %[[TMP_182:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_181]]
// CHECK: %[[TMP_183:.*]] = mhlo.multiply %[[TMP_179]], %[[TMP_182]]
// CHECK: %[[TMP_184:.*]] = mhlo.constant dense<1.000000e+01>
// CHECK: %[[TMP_185:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_184]]
// CHECK: %[[TMP_186:.*]] = mhlo.constant dense<9.000000e+00>
// CHECK: %[[TMP_187:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_186]]
// CHECK: %[[TMP_188:.*]] = mhlo.multiply %[[TMP_185]], %[[TMP_187]]
// CHECK: %[[TMP_189:.*]] = mhlo.constant dense<-5.28419031E-10>
// CHECK: %[[TMP_190:.*]] = mhlo.add %[[TMP_183]], %[[TMP_189]]
// CHECK: %[[TMP_191:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_190]]
// CHECK: %[[TMP_192:.*]] = mhlo.multiply %[[TMP_188]], %[[TMP_191]]
// CHECK: %[[TMP_193:.*]] = mhlo.constant dense<8.000000e+00>
// CHECK: %[[TMP_194:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_193]]
// CHECK: %[[TMP_195:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_196:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_195]]
// CHECK: %[[TMP_197:.*]] = mhlo.multiply %[[TMP_194]], %[[TMP_196]]
// CHECK: %[[TMP_198:.*]] = mhlo.constant dense<2.08767563E-8>
// CHECK: %[[TMP_199:.*]] = mhlo.add %[[TMP_192]], %[[TMP_198]]
// CHECK: %[[TMP_200:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_199]]
// CHECK: %[[TMP_201:.*]] = mhlo.multiply %[[TMP_197]], %[[TMP_200]]
// CHECK: %[[TMP_202:.*]] = mhlo.constant dense<6.000000e+00>
// CHECK: %[[TMP_203:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_202]]
// CHECK: %[[TMP_204:.*]] = mhlo.constant dense<5.000000e+00>
// CHECK: %[[TMP_205:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_204]]
// CHECK: %[[TMP_206:.*]] = mhlo.multiply %[[TMP_203]], %[[TMP_205]]
// CHECK: %[[TMP_207:.*]] = mhlo.constant dense<-8.26719599E-7>
// CHECK: %[[TMP_208:.*]] = mhlo.add %[[TMP_201]], %[[TMP_207]]
// CHECK: %[[TMP_209:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_208]]
// CHECK: %[[TMP_210:.*]] = mhlo.multiply %[[TMP_206]], %[[TMP_209]]
// CHECK: %[[TMP_211:.*]] = mhlo.constant dense<4.000000e+00>
// CHECK: %[[TMP_212:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_211]]
// CHECK: %[[TMP_213:.*]] = mhlo.constant dense<3.000000e+00>
// CHECK: %[[TMP_214:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_213]]
// CHECK: %[[TMP_215:.*]] = mhlo.multiply %[[TMP_212]], %[[TMP_214]]
// CHECK: %[[TMP_216:.*]] = mhlo.constant dense<3.30687835E-5>
// CHECK: %[[TMP_217:.*]] = mhlo.add %[[TMP_210]], %[[TMP_216]]
// CHECK: %[[TMP_218:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_217]]
// CHECK: %[[TMP_219:.*]] = mhlo.multiply %[[TMP_215]], %[[TMP_218]]
// CHECK: %[[TMP_220:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_221:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_220]]
// CHECK: %[[TMP_222:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_223:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_222]]
// CHECK: %[[TMP_224:.*]] = mhlo.multiply %[[TMP_221]], %[[TMP_223]]
// CHECK: %[[TMP_225:.*]] = mhlo.constant dense<-0.00138888892>
// CHECK: %[[TMP_226:.*]] = mhlo.add %[[TMP_219]], %[[TMP_225]]
// CHECK: %[[TMP_227:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_226]]
// CHECK: %[[TMP_228:.*]] = mhlo.multiply %[[TMP_224]], %[[TMP_227]]
// CHECK: %[[TMP_229:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_230:.*]] = mhlo.divide %[[TMP_5]], %[[TMP_121]]
// CHECK: %[[TMP_231:.*]] = mhlo.constant dense<0.0833333358>
// CHECK: %[[TMP_232:.*]] = mhlo.add %[[TMP_231]], %[[TMP_228]]
// CHECK: %[[TMP_233:.*]] = mhlo.multiply %[[TMP_230]], %[[TMP_232]]
// CHECK: %[[TMP_234:.*]] = mhlo.add %[[TMP_229]], %[[TMP_233]]
// CHECK: %[[TMP_235:.*]] = mhlo.multiply %[[TMP_122]], %[[TMP_234]]
// CHECK: %[[TMP_236:.*]] = mhlo.add %[[TMP_127]], %[[TMP_235]]
// CHECK: %[[TMP_237:.*]] = "mhlo.abs"(%[[TMP_122]])
// CHECK: %[[TMP_238:.*]] = "mhlo.abs"(%[[TMP_120]])
// CHECK: %[[TMP_239:.*]] = mhlo.constant dense<1.401300e-45>
// CHECK: %[[TMP_240:.*]] = mhlo.multiply %[[TMP_238]], %[[TMP_239]]
// CHECK: %[[TMP_241:.*]] = "mhlo.compare"(%[[TMP_237]], %[[TMP_240]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_242:.*]] = "mhlo.select"(%[[TMP_241]], %[[TMP_120]], %[[TMP_236]])
// CHECK: %[[TMP_243:.*]] = mhlo.constant dense<0x7F800000>
// CHECK: %[[TMP_244:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_123]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_245:.*]] = "mhlo.select"(%[[TMP_244]], %[[TMP_243]], %[[TMP_242]])
// CHECK: %[[TMP_246:.*]] = mhlo.constant dense<0x7FC00000>
// CHECK: %[[TMP_247:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_123]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_248:.*]] = "mhlo.select"(%[[TMP_247]], %[[TMP_246]], %[[TMP_245]])
// CHECK: %[[TMP_249:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_250:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_249]]) {comparison_direction = "LE"}
// CHECK: %[[TMP_251:.*]] = "mhlo.floor"(%[[TMP_5]])
// CHECK: %[[TMP_252:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_251]]) {comparison_direction = "NE"}
// CHECK: %[[TMP_253:.*]] = mhlo.and %[[TMP_250]], %[[TMP_252]]
// CHECK: %[[TMP_254:.*]] = "mhlo.floor"(%[[ARG1]])
// CHECK: %[[TMP_255:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_254]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_256:.*]] = mhlo.and %[[TMP_250]], %[[TMP_255]]
// CHECK: %[[TMP_257:.*]] = "mhlo.select"(%[[TMP_256]], %[[TMP_243]], %[[TMP_248]])
// CHECK: %[[TMP_258:.*]] = "mhlo.select"(%[[TMP_253]], %[[TMP_246]], %[[TMP_257]])
// CHECK: %[[TMP_259:.*]] = mhlo.multiply %[[TMP_4]], %[[TMP_89]]
// CHECK: %[[TMP_260:.*]] = mhlo.multiply %[[TMP_259]], %[[TMP_258]]
// CHECK: %[[TMP_261:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_262:.*]] = "mhlo.compare"(%[[ARG0]], %[[TMP_261]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_263:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_264:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_263]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_265:.*]] = "mhlo.negate"(%[[ARG1]])
// CHECK: %[[TMP_266:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_267:.*]] = mhlo.subtract %[[ARG1]], %[[TMP_266]]
// CHECK: %[[TMP_268:.*]] = "mhlo.select"(%[[TMP_264]], %[[TMP_265]], %[[TMP_267]])
// CHECK: %[[TMP_269:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_270:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_271:.*]] = mhlo.constant dense<676.520386>
// CHECK: %[[TMP_272:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_273:.*]] = mhlo.add %[[TMP_268]], %[[TMP_272]]
// CHECK: %[[TMP_274:.*]] = mhlo.multiply %[[TMP_273]], %[[TMP_273]]
// CHECK: %[[TMP_275:.*]] = mhlo.divide %[[TMP_271]], %[[TMP_274]]
// CHECK: %[[TMP_276:.*]] = mhlo.subtract %[[TMP_269]], %[[TMP_275]]
// CHECK: %[[TMP_277:.*]] = mhlo.divide %[[TMP_271]], %[[TMP_273]]
// CHECK: %[[TMP_278:.*]] = mhlo.add %[[TMP_270]], %[[TMP_277]]
// CHECK: %[[TMP_279:.*]] = mhlo.constant dense<-1259.13916>
// CHECK: %[[TMP_280:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_281:.*]] = mhlo.add %[[TMP_268]], %[[TMP_280]]
// CHECK: %[[TMP_282:.*]] = mhlo.multiply %[[TMP_281]], %[[TMP_281]]
// CHECK: %[[TMP_283:.*]] = mhlo.divide %[[TMP_279]], %[[TMP_282]]
// CHECK: %[[TMP_284:.*]] = mhlo.subtract %[[TMP_276]], %[[TMP_283]]
// CHECK: %[[TMP_285:.*]] = mhlo.divide %[[TMP_279]], %[[TMP_281]]
// CHECK: %[[TMP_286:.*]] = mhlo.add %[[TMP_278]], %[[TMP_285]]
// CHECK: %[[TMP_287:.*]] = mhlo.constant dense<771.323425>
// CHECK: %[[TMP_288:.*]] = mhlo.constant dense<3.000000e+00>
// CHECK: %[[TMP_289:.*]] = mhlo.add %[[TMP_268]], %[[TMP_288]]
// CHECK: %[[TMP_290:.*]] = mhlo.multiply %[[TMP_289]], %[[TMP_289]]
// CHECK: %[[TMP_291:.*]] = mhlo.divide %[[TMP_287]], %[[TMP_290]]
// CHECK: %[[TMP_292:.*]] = mhlo.subtract %[[TMP_284]], %[[TMP_291]]
// CHECK: %[[TMP_293:.*]] = mhlo.divide %[[TMP_287]], %[[TMP_289]]
// CHECK: %[[TMP_294:.*]] = mhlo.add %[[TMP_286]], %[[TMP_293]]
// CHECK: %[[TMP_295:.*]] = mhlo.constant dense<-176.615036>
// CHECK: %[[TMP_296:.*]] = mhlo.constant dense<4.000000e+00>
// CHECK: %[[TMP_297:.*]] = mhlo.add %[[TMP_268]], %[[TMP_296]]
// CHECK: %[[TMP_298:.*]] = mhlo.multiply %[[TMP_297]], %[[TMP_297]]
// CHECK: %[[TMP_299:.*]] = mhlo.divide %[[TMP_295]], %[[TMP_298]]
// CHECK: %[[TMP_300:.*]] = mhlo.subtract %[[TMP_292]], %[[TMP_299]]
// CHECK: %[[TMP_301:.*]] = mhlo.divide %[[TMP_295]], %[[TMP_297]]
// CHECK: %[[TMP_302:.*]] = mhlo.add %[[TMP_294]], %[[TMP_301]]
// CHECK: %[[TMP_303:.*]] = mhlo.constant dense<12.5073433>
// CHECK: %[[TMP_304:.*]] = mhlo.constant dense<5.000000e+00>
// CHECK: %[[TMP_305:.*]] = mhlo.add %[[TMP_268]], %[[TMP_304]]
// CHECK: %[[TMP_306:.*]] = mhlo.multiply %[[TMP_305]], %[[TMP_305]]
// CHECK: %[[TMP_307:.*]] = mhlo.divide %[[TMP_303]], %[[TMP_306]]
// CHECK: %[[TMP_308:.*]] = mhlo.subtract %[[TMP_300]], %[[TMP_307]]
// CHECK: %[[TMP_309:.*]] = mhlo.divide %[[TMP_303]], %[[TMP_305]]
// CHECK: %[[TMP_310:.*]] = mhlo.add %[[TMP_302]], %[[TMP_309]]
// CHECK: %[[TMP_311:.*]] = mhlo.constant dense<-0.138571098>
// CHECK: %[[TMP_312:.*]] = mhlo.constant dense<6.000000e+00>
// CHECK: %[[TMP_313:.*]] = mhlo.add %[[TMP_268]], %[[TMP_312]]
// CHECK: %[[TMP_314:.*]] = mhlo.multiply %[[TMP_313]], %[[TMP_313]]
// CHECK: %[[TMP_315:.*]] = mhlo.divide %[[TMP_311]], %[[TMP_314]]
// CHECK: %[[TMP_316:.*]] = mhlo.subtract %[[TMP_308]], %[[TMP_315]]
// CHECK: %[[TMP_317:.*]] = mhlo.divide %[[TMP_311]], %[[TMP_313]]
// CHECK: %[[TMP_318:.*]] = mhlo.add %[[TMP_310]], %[[TMP_317]]
// CHECK: %[[TMP_319:.*]] = mhlo.constant dense<9.98436917E-6>
// CHECK: %[[TMP_320:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_321:.*]] = mhlo.add %[[TMP_268]], %[[TMP_320]]
// CHECK: %[[TMP_322:.*]] = mhlo.multiply %[[TMP_321]], %[[TMP_321]]
// CHECK: %[[TMP_323:.*]] = mhlo.divide %[[TMP_319]], %[[TMP_322]]
// CHECK: %[[TMP_324:.*]] = mhlo.subtract %[[TMP_316]], %[[TMP_323]]
// CHECK: %[[TMP_325:.*]] = mhlo.divide %[[TMP_319]], %[[TMP_321]]
// CHECK: %[[TMP_326:.*]] = mhlo.add %[[TMP_318]], %[[TMP_325]]
// CHECK: %[[TMP_327:.*]] = mhlo.constant dense<1.50563267E-7>
// CHECK: %[[TMP_328:.*]] = mhlo.constant dense<8.000000e+00>
// CHECK: %[[TMP_329:.*]] = mhlo.add %[[TMP_268]], %[[TMP_328]]
// CHECK: %[[TMP_330:.*]] = mhlo.multiply %[[TMP_329]], %[[TMP_329]]
// CHECK: %[[TMP_331:.*]] = mhlo.divide %[[TMP_327]], %[[TMP_330]]
// CHECK: %[[TMP_332:.*]] = mhlo.subtract %[[TMP_324]], %[[TMP_331]]
// CHECK: %[[TMP_333:.*]] = mhlo.divide %[[TMP_327]], %[[TMP_329]]
// CHECK: %[[TMP_334:.*]] = mhlo.add %[[TMP_326]], %[[TMP_333]]
// CHECK: %[[TMP_335:.*]] = mhlo.constant dense<7.500000e+00>
// CHECK: %[[TMP_336:.*]] = mhlo.add %[[TMP_335]], %[[TMP_268]]
// CHECK: %[[TMP_337:.*]] = mhlo.constant dense<2.01490307>
// CHECK: %[[TMP_338:.*]] = mhlo.divide %[[TMP_268]], %[[TMP_335]]
// CHECK: %[[TMP_339:.*]] = "mhlo.log_plus_one"(%[[TMP_338]])
// CHECK: %[[TMP_340:.*]] = mhlo.add %[[TMP_337]], %[[TMP_339]]
// CHECK: %[[TMP_341:.*]] = mhlo.divide %[[TMP_332]], %[[TMP_334]]
// CHECK: %[[TMP_342:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_343:.*]] = mhlo.divide %[[TMP_342]], %[[TMP_336]]
// CHECK: %[[TMP_344:.*]] = mhlo.add %[[TMP_340]], %[[TMP_341]]
// CHECK: %[[TMP_345:.*]] = mhlo.subtract %[[TMP_344]], %[[TMP_343]]
// CHECK: %[[TMP_346:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_347:.*]] = mhlo.add %[[ARG1]], %[[TMP_346]]
// CHECK: %[[TMP_348:.*]] = "mhlo.floor"(%[[TMP_347]])
// CHECK: %[[TMP_349:.*]] = "mhlo.abs"(%[[TMP_348]])
// CHECK: %[[TMP_350:.*]] = mhlo.add %[[ARG1]], %[[TMP_349]]
// CHECK: %[[TMP_351:.*]] = mhlo.constant dense<3.14159274>
// CHECK: %[[TMP_352:.*]] = mhlo.multiply %[[TMP_351]], %[[TMP_350]]
// CHECK: %[[TMP_353:.*]] = "mhlo.cosine"(%[[TMP_352]])
// CHECK: %[[TMP_354:.*]] = "mhlo.sine"(%[[TMP_352]])
// CHECK: %[[TMP_355:.*]] = mhlo.multiply %[[TMP_351]], %[[TMP_353]]
// CHECK: %[[TMP_356:.*]] = mhlo.divide %[[TMP_355]], %[[TMP_354]]
// CHECK: %[[TMP_357:.*]] = mhlo.subtract %[[TMP_345]], %[[TMP_356]]
// CHECK: %[[TMP_358:.*]] = "mhlo.select"(%[[TMP_264]], %[[TMP_357]], %[[TMP_345]])
// CHECK: %[[TMP_359:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_269]]) {comparison_direction = "LE"}
// CHECK: %[[TMP_360:.*]] = "mhlo.floor"(%[[ARG1]])
// CHECK: %[[TMP_361:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_360]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_362:.*]] = mhlo.and %[[TMP_359]], %[[TMP_361]]
// CHECK: %[[TMP_363:.*]] = mhlo.constant dense<0x7FC00000>
// CHECK: %[[TMP_364:.*]] = "mhlo.select"(%[[TMP_362]], %[[TMP_363]], %[[TMP_358]])
// CHECK: %[[TMP_365:.*]] = "mhlo.select"(%[[TMP_262]], %[[TMP_364]], %[[TMP_260]])
// CHECK: %[[TMP_366:.*]] = "mhlo.floor"(%[[ARG0]])
// CHECK: %[[TMP_367:.*]] = "mhlo.compare"(%[[ARG0]], %[[TMP_366]]) {comparison_direction = "NE"}
// CHECK: %[[TMP_368:.*]] = "mhlo.compare"(%[[ARG0]], %[[TMP_261]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_369:.*]] = mhlo.or %[[TMP_367]], %[[TMP_368]]
// CHECK: %[[TMP_370:.*]] = mhlo.constant dense<0x7FC00000>
// CHECK: %[[TMP_371:.*]] = "mhlo.select"(%[[TMP_369]], %[[TMP_370]], %[[TMP_365]])
// CHECK: return %[[TMP_371]]
%1 = chlo.polygamma %lhs, %rhs : tensor<f32>, tensor<f32> -> tensor<f32>
return %1 : tensor<f32>
}
// CHECK: @polygamma_f64
// CHECK-SAME: (%[[ARG0:.*]]: tensor<f64>, %[[ARG1:.*]]: tensor<f64>)
func @polygamma_f64(%lhs : tensor<f64>, %rhs : tensor<f64>) -> tensor<f64> {
// CHECK: %[[TMP_0:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_1:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_2:.*]] = mhlo.remainder %[[ARG0]], %[[TMP_1]]
// CHECK: %[[TMP_3:.*]] = mhlo.multiply %[[TMP_1]], %[[TMP_2]]
// CHECK: %[[TMP_4:.*]] = mhlo.subtract %[[TMP_3]], %[[TMP_0]]
// CHECK: %[[TMP_5:.*]] = mhlo.add %[[ARG0]], %[[TMP_0]]
// CHECK: %[[TMP_6:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_7:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_6]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_8:.*]] = "mhlo.negate"(%[[TMP_5]])
// CHECK: %[[TMP_9:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_10:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_9]]
// CHECK: %[[TMP_11:.*]] = "mhlo.select"(%[[TMP_7]], %[[TMP_8]], %[[TMP_10]])
// CHECK: %[[TMP_12:.*]] = mhlo.constant dense<0.99999999999980993>
// CHECK: %[[TMP_13:.*]] = mhlo.constant dense<676.5203681218851>
// CHECK: %[[TMP_14:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_15:.*]] = mhlo.add %[[TMP_11]], %[[TMP_14]]
// CHECK: %[[TMP_16:.*]] = mhlo.divide %[[TMP_13]], %[[TMP_15]]
// CHECK: %[[TMP_17:.*]] = mhlo.add %[[TMP_12]], %[[TMP_16]]
// CHECK: %[[TMP_18:.*]] = mhlo.constant dense<-1259.1392167224028>
// CHECK: %[[TMP_19:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_20:.*]] = mhlo.add %[[TMP_11]], %[[TMP_19]]
// CHECK: %[[TMP_21:.*]] = mhlo.divide %[[TMP_18]], %[[TMP_20]]
// CHECK: %[[TMP_22:.*]] = mhlo.add %[[TMP_17]], %[[TMP_21]]
// CHECK: %[[TMP_23:.*]] = mhlo.constant dense<771.32342877765313>
// CHECK: %[[TMP_24:.*]] = mhlo.constant dense<3.000000e+00>
// CHECK: %[[TMP_25:.*]] = mhlo.add %[[TMP_11]], %[[TMP_24]]
// CHECK: %[[TMP_26:.*]] = mhlo.divide %[[TMP_23]], %[[TMP_25]]
// CHECK: %[[TMP_27:.*]] = mhlo.add %[[TMP_22]], %[[TMP_26]]
// CHECK: %[[TMP_28:.*]] = mhlo.constant dense<-176.61502916214059>
// CHECK: %[[TMP_29:.*]] = mhlo.constant dense<4.000000e+00>
// CHECK: %[[TMP_30:.*]] = mhlo.add %[[TMP_11]], %[[TMP_29]]
// CHECK: %[[TMP_31:.*]] = mhlo.divide %[[TMP_28]], %[[TMP_30]]
// CHECK: %[[TMP_32:.*]] = mhlo.add %[[TMP_27]], %[[TMP_31]]
// CHECK: %[[TMP_33:.*]] = mhlo.constant dense<12.507343278686905>
// CHECK: %[[TMP_34:.*]] = mhlo.constant dense<5.000000e+00>
// CHECK: %[[TMP_35:.*]] = mhlo.add %[[TMP_11]], %[[TMP_34]]
// CHECK: %[[TMP_36:.*]] = mhlo.divide %[[TMP_33]], %[[TMP_35]]
// CHECK: %[[TMP_37:.*]] = mhlo.add %[[TMP_32]], %[[TMP_36]]
// CHECK: %[[TMP_38:.*]] = mhlo.constant dense<-0.13857109526572012>
// CHECK: %[[TMP_39:.*]] = mhlo.constant dense<6.000000e+00>
// CHECK: %[[TMP_40:.*]] = mhlo.add %[[TMP_11]], %[[TMP_39]]
// CHECK: %[[TMP_41:.*]] = mhlo.divide %[[TMP_38]], %[[TMP_40]]
// CHECK: %[[TMP_42:.*]] = mhlo.add %[[TMP_37]], %[[TMP_41]]
// CHECK: %[[TMP_43:.*]] = mhlo.constant dense<9.9843695780195716E-6>
// CHECK: %[[TMP_44:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_45:.*]] = mhlo.add %[[TMP_11]], %[[TMP_44]]
// CHECK: %[[TMP_46:.*]] = mhlo.divide %[[TMP_43]], %[[TMP_45]]
// CHECK: %[[TMP_47:.*]] = mhlo.add %[[TMP_42]], %[[TMP_46]]
// CHECK: %[[TMP_48:.*]] = mhlo.constant dense<1.5056327351493116E-7>
// CHECK: %[[TMP_49:.*]] = mhlo.constant dense<8.000000e+00>
// CHECK: %[[TMP_50:.*]] = mhlo.add %[[TMP_11]], %[[TMP_49]]
// CHECK: %[[TMP_51:.*]] = mhlo.divide %[[TMP_48]], %[[TMP_50]]
// CHECK: %[[TMP_52:.*]] = mhlo.add %[[TMP_47]], %[[TMP_51]]
// CHECK: %[[TMP_53:.*]] = mhlo.constant dense<7.500000e+00>
// CHECK: %[[TMP_54:.*]] = mhlo.add %[[TMP_53]], %[[TMP_11]]
// CHECK: %[[TMP_55:.*]] = mhlo.constant dense<2.0149030205422647>
// CHECK: %[[TMP_56:.*]] = mhlo.divide %[[TMP_11]], %[[TMP_53]]
// CHECK: %[[TMP_57:.*]] = "mhlo.log_plus_one"(%[[TMP_56]])
// CHECK: %[[TMP_58:.*]] = mhlo.add %[[TMP_55]], %[[TMP_57]]
// CHECK: %[[TMP_59:.*]] = mhlo.divide %[[TMP_54]], %[[TMP_58]]
// CHECK: %[[TMP_60:.*]] = mhlo.add %[[TMP_11]], %[[TMP_6]]
// CHECK: %[[TMP_61:.*]] = mhlo.subtract %[[TMP_60]], %[[TMP_59]]
// CHECK: %[[TMP_62:.*]] = mhlo.multiply %[[TMP_61]], %[[TMP_58]]
// CHECK: %[[TMP_63:.*]] = "mhlo.log"(%[[TMP_52]])
// CHECK: %[[TMP_64:.*]] = mhlo.constant dense<0.91893853320467266>
// CHECK: %[[TMP_65:.*]] = mhlo.add %[[TMP_64]], %[[TMP_62]]
// CHECK: %[[TMP_66:.*]] = mhlo.add %[[TMP_65]], %[[TMP_63]]
// CHECK: %[[TMP_67:.*]] = "mhlo.abs"(%[[TMP_5]])
// CHECK: %[[TMP_68:.*]] = "mhlo.floor"(%[[TMP_67]])
// CHECK: %[[TMP_69:.*]] = mhlo.subtract %[[TMP_67]], %[[TMP_68]]
// CHECK: %[[TMP_70:.*]] = "mhlo.compare"(%[[TMP_6]], %[[TMP_69]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_71:.*]] = mhlo.subtract %[[TMP_9]], %[[TMP_69]]
// CHECK: %[[TMP_72:.*]] = "mhlo.select"(%[[TMP_70]], %[[TMP_71]], %[[TMP_69]])
// CHECK: %[[TMP_73:.*]] = mhlo.constant dense<3.1415926535897931>
// CHECK: %[[TMP_74:.*]] = mhlo.multiply %[[TMP_73]], %[[TMP_72]]
// CHECK: %[[TMP_75:.*]] = "mhlo.sine"(%[[TMP_74]])
// CHECK: %[[TMP_76:.*]] = "mhlo.log"(%[[TMP_75]])
// CHECK: %[[TMP_77:.*]] = mhlo.constant dense<1.1447298858494002>
// CHECK: %[[TMP_78:.*]] = mhlo.subtract %[[TMP_77]], %[[TMP_76]]
// CHECK: %[[TMP_79:.*]] = mhlo.subtract %[[TMP_78]], %[[TMP_66]]
// CHECK: %[[TMP_80:.*]] = "mhlo.is_finite"(%[[TMP_76]])
// CHECK: %[[TMP_81:.*]] = "mhlo.negate"(%[[TMP_76]])
// CHECK: %[[TMP_82:.*]] = "mhlo.select"(%[[TMP_80]], %[[TMP_79]], %[[TMP_81]])
// CHECK: %[[TMP_83:.*]] = "mhlo.select"(%[[TMP_7]], %[[TMP_82]], %[[TMP_66]])
// CHECK: %[[TMP_84:.*]] = "mhlo.abs"(%[[TMP_5]])
// CHECK: %[[TMP_85:.*]] = mhlo.constant dense<0x7FF0000000000000>
// CHECK: %[[TMP_86:.*]] = "mhlo.compare"(%[[TMP_84]], %[[TMP_85]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_87:.*]] = mhlo.constant dense<0x7FF0000000000000>
// CHECK: %[[TMP_88:.*]] = "mhlo.select"(%[[TMP_86]], %[[TMP_87]], %[[TMP_83]])
// CHECK: %[[TMP_89:.*]] = "mhlo.exponential"(%[[TMP_88]])
// CHECK: %[[TMP_90:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_91:.*]] = "mhlo.negate"(%[[TMP_5]])
// CHECK: %[[TMP_92:.*]] = mhlo.power %[[ARG1]], %[[TMP_91]]
// CHECK: %[[TMP_93:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_94:.*]] = mhlo.add %[[ARG1]], %[[TMP_93]]
// CHECK: %[[TMP_95:.*]] = mhlo.power %[[TMP_94]], %[[TMP_91]]
// CHECK: %[[TMP_96:.*]] = mhlo.add %[[TMP_92]], %[[TMP_95]]
// CHECK: %[[TMP_97:.*]] = mhlo.add %[[TMP_94]], %[[TMP_93]]
// CHECK: %[[TMP_98:.*]] = mhlo.power %[[TMP_97]], %[[TMP_91]]
// CHECK: %[[TMP_99:.*]] = mhlo.add %[[TMP_96]], %[[TMP_98]]
// CHECK: %[[TMP_100:.*]] = mhlo.add %[[TMP_97]], %[[TMP_93]]
// CHECK: %[[TMP_101:.*]] = mhlo.power %[[TMP_100]], %[[TMP_91]]
// CHECK: %[[TMP_102:.*]] = mhlo.add %[[TMP_99]], %[[TMP_101]]
// CHECK: %[[TMP_103:.*]] = mhlo.add %[[TMP_100]], %[[TMP_93]]
// CHECK: %[[TMP_104:.*]] = mhlo.power %[[TMP_103]], %[[TMP_91]]
// CHECK: %[[TMP_105:.*]] = mhlo.add %[[TMP_102]], %[[TMP_104]]
// CHECK: %[[TMP_106:.*]] = mhlo.add %[[TMP_103]], %[[TMP_93]]
// CHECK: %[[TMP_107:.*]] = mhlo.power %[[TMP_106]], %[[TMP_91]]
// CHECK: %[[TMP_108:.*]] = mhlo.add %[[TMP_105]], %[[TMP_107]]
// CHECK: %[[TMP_109:.*]] = mhlo.add %[[TMP_106]], %[[TMP_93]]
// CHECK: %[[TMP_110:.*]] = mhlo.power %[[TMP_109]], %[[TMP_91]]
// CHECK: %[[TMP_111:.*]] = mhlo.add %[[TMP_108]], %[[TMP_110]]
// CHECK: %[[TMP_112:.*]] = mhlo.add %[[TMP_109]], %[[TMP_93]]
// CHECK: %[[TMP_113:.*]] = mhlo.power %[[TMP_112]], %[[TMP_91]]
// CHECK: %[[TMP_114:.*]] = mhlo.add %[[TMP_111]], %[[TMP_113]]
// CHECK: %[[TMP_115:.*]] = mhlo.add %[[TMP_112]], %[[TMP_93]]
// CHECK: %[[TMP_116:.*]] = mhlo.power %[[TMP_115]], %[[TMP_91]]
// CHECK: %[[TMP_117:.*]] = mhlo.add %[[TMP_114]], %[[TMP_116]]
// CHECK: %[[TMP_118:.*]] = mhlo.add %[[TMP_115]], %[[TMP_93]]
// CHECK: %[[TMP_119:.*]] = mhlo.power %[[TMP_118]], %[[TMP_91]]
// CHECK: %[[TMP_120:.*]] = mhlo.add %[[TMP_117]], %[[TMP_119]]
// CHECK: %[[TMP_121:.*]] = mhlo.add %[[TMP_118]], %[[TMP_93]]
// CHECK: %[[TMP_122:.*]] = mhlo.power %[[TMP_121]], %[[TMP_91]]
// CHECK: %[[TMP_123:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_124:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_123]]
// CHECK: %[[TMP_125:.*]] = mhlo.multiply %[[TMP_122]], %[[TMP_121]]
// CHECK: %[[TMP_126:.*]] = mhlo.divide %[[TMP_125]], %[[TMP_124]]
// CHECK: %[[TMP_127:.*]] = mhlo.add %[[TMP_120]], %[[TMP_126]]
// CHECK: %[[TMP_128:.*]] = mhlo.multiply %[[TMP_121]], %[[TMP_121]]
// CHECK: %[[TMP_129:.*]] = mhlo.divide %[[TMP_93]], %[[TMP_128]]
// CHECK: %[[TMP_130:.*]] = mhlo.constant dense<2.200000e+01>
// CHECK: %[[TMP_131:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_130]]
// CHECK: %[[TMP_132:.*]] = mhlo.constant dense<2.100000e+01>
// CHECK: %[[TMP_133:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_132]]
// CHECK: %[[TMP_134:.*]] = mhlo.multiply %[[TMP_131]], %[[TMP_133]]
// CHECK: %[[TMP_135:.*]] = mhlo.constant dense<-1.3954464685812522E-19>
// CHECK: %[[TMP_136:.*]] = mhlo.add %[[TMP_90]], %[[TMP_135]]
// CHECK: %[[TMP_137:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_136]]
// CHECK: %[[TMP_138:.*]] = mhlo.multiply %[[TMP_134]], %[[TMP_137]]
// CHECK: %[[TMP_139:.*]] = mhlo.constant dense<2.000000e+01>
// CHECK: %[[TMP_140:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_139]]
// CHECK: %[[TMP_141:.*]] = mhlo.constant dense<1.900000e+01>
// CHECK: %[[TMP_142:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_141]]
// CHECK: %[[TMP_143:.*]] = mhlo.multiply %[[TMP_140]], %[[TMP_142]]
// CHECK: %[[TMP_144:.*]] = mhlo.constant dense<5.5090028283602295E-18>
// CHECK: %[[TMP_145:.*]] = mhlo.add %[[TMP_138]], %[[TMP_144]]
// CHECK: %[[TMP_146:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_145]]
// CHECK: %[[TMP_147:.*]] = mhlo.multiply %[[TMP_143]], %[[TMP_146]]
// CHECK: %[[TMP_148:.*]] = mhlo.constant dense<1.800000e+01>
// CHECK: %[[TMP_149:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_148]]
// CHECK: %[[TMP_150:.*]] = mhlo.constant dense<1.700000e+01>
// CHECK: %[[TMP_151:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_150]]
// CHECK: %[[TMP_152:.*]] = mhlo.multiply %[[TMP_149]], %[[TMP_151]]
// CHECK: %[[TMP_153:.*]] = mhlo.constant dense<-2.1748686985580617E-16>
// CHECK: %[[TMP_154:.*]] = mhlo.add %[[TMP_147]], %[[TMP_153]]
// CHECK: %[[TMP_155:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_154]]
// CHECK: %[[TMP_156:.*]] = mhlo.multiply %[[TMP_152]], %[[TMP_155]]
// CHECK: %[[TMP_157:.*]] = mhlo.constant dense<1.600000e+01>
// CHECK: %[[TMP_158:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_157]]
// CHECK: %[[TMP_159:.*]] = mhlo.constant dense<1.500000e+01>
// CHECK: %[[TMP_160:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_159]]
// CHECK: %[[TMP_161:.*]] = mhlo.multiply %[[TMP_158]], %[[TMP_160]]
// CHECK: %[[TMP_162:.*]] = mhlo.constant dense<8.5860620562778452E-15>
// CHECK: %[[TMP_163:.*]] = mhlo.add %[[TMP_156]], %[[TMP_162]]
// CHECK: %[[TMP_164:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_163]]
// CHECK: %[[TMP_165:.*]] = mhlo.multiply %[[TMP_161]], %[[TMP_164]]
// CHECK: %[[TMP_166:.*]] = mhlo.constant dense<1.400000e+01>
// CHECK: %[[TMP_167:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_166]]
// CHECK: %[[TMP_168:.*]] = mhlo.constant dense<1.300000e+01>
// CHECK: %[[TMP_169:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_168]]
// CHECK: %[[TMP_170:.*]] = mhlo.multiply %[[TMP_167]], %[[TMP_169]]
// CHECK: %[[TMP_171:.*]] = mhlo.constant dense<-3.3896802963225832E-13>
// CHECK: %[[TMP_172:.*]] = mhlo.add %[[TMP_165]], %[[TMP_171]]
// CHECK: %[[TMP_173:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_172]]
// CHECK: %[[TMP_174:.*]] = mhlo.multiply %[[TMP_170]], %[[TMP_173]]
// CHECK: %[[TMP_175:.*]] = mhlo.constant dense<1.200000e+01>
// CHECK: %[[TMP_176:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_175]]
// CHECK: %[[TMP_177:.*]] = mhlo.constant dense<1.100000e+01>
// CHECK: %[[TMP_178:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_177]]
// CHECK: %[[TMP_179:.*]] = mhlo.multiply %[[TMP_176]], %[[TMP_178]]
// CHECK: %[[TMP_180:.*]] = mhlo.constant dense<1.3382536530684679E-11>
// CHECK: %[[TMP_181:.*]] = mhlo.add %[[TMP_174]], %[[TMP_180]]
// CHECK: %[[TMP_182:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_181]]
// CHECK: %[[TMP_183:.*]] = mhlo.multiply %[[TMP_179]], %[[TMP_182]]
// CHECK: %[[TMP_184:.*]] = mhlo.constant dense<1.000000e+01>
// CHECK: %[[TMP_185:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_184]]
// CHECK: %[[TMP_186:.*]] = mhlo.constant dense<9.000000e+00>
// CHECK: %[[TMP_187:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_186]]
// CHECK: %[[TMP_188:.*]] = mhlo.multiply %[[TMP_185]], %[[TMP_187]]
// CHECK: %[[TMP_189:.*]] = mhlo.constant dense<-5.2841901386874932E-10>
// CHECK: %[[TMP_190:.*]] = mhlo.add %[[TMP_183]], %[[TMP_189]]
// CHECK: %[[TMP_191:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_190]]
// CHECK: %[[TMP_192:.*]] = mhlo.multiply %[[TMP_188]], %[[TMP_191]]
// CHECK: %[[TMP_193:.*]] = mhlo.constant dense<8.000000e+00>
// CHECK: %[[TMP_194:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_193]]
// CHECK: %[[TMP_195:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_196:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_195]]
// CHECK: %[[TMP_197:.*]] = mhlo.multiply %[[TMP_194]], %[[TMP_196]]
// CHECK: %[[TMP_198:.*]] = mhlo.constant dense<2.08767569878681E-8>
// CHECK: %[[TMP_199:.*]] = mhlo.add %[[TMP_192]], %[[TMP_198]]
// CHECK: %[[TMP_200:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_199]]
// CHECK: %[[TMP_201:.*]] = mhlo.multiply %[[TMP_197]], %[[TMP_200]]
// CHECK: %[[TMP_202:.*]] = mhlo.constant dense<6.000000e+00>
// CHECK: %[[TMP_203:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_202]]
// CHECK: %[[TMP_204:.*]] = mhlo.constant dense<5.000000e+00>
// CHECK: %[[TMP_205:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_204]]
// CHECK: %[[TMP_206:.*]] = mhlo.multiply %[[TMP_203]], %[[TMP_205]]
// CHECK: %[[TMP_207:.*]] = mhlo.constant dense<-8.2671957671957675E-7>
// CHECK: %[[TMP_208:.*]] = mhlo.add %[[TMP_201]], %[[TMP_207]]
// CHECK: %[[TMP_209:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_208]]
// CHECK: %[[TMP_210:.*]] = mhlo.multiply %[[TMP_206]], %[[TMP_209]]
// CHECK: %[[TMP_211:.*]] = mhlo.constant dense<4.000000e+00>
// CHECK: %[[TMP_212:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_211]]
// CHECK: %[[TMP_213:.*]] = mhlo.constant dense<3.000000e+00>
// CHECK: %[[TMP_214:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_213]]
// CHECK: %[[TMP_215:.*]] = mhlo.multiply %[[TMP_212]], %[[TMP_214]]
// CHECK: %[[TMP_216:.*]] = mhlo.constant dense<3.3068783068783071E-5>
// CHECK: %[[TMP_217:.*]] = mhlo.add %[[TMP_210]], %[[TMP_216]]
// CHECK: %[[TMP_218:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_217]]
// CHECK: %[[TMP_219:.*]] = mhlo.multiply %[[TMP_215]], %[[TMP_218]]
// CHECK: %[[TMP_220:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_221:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_220]]
// CHECK: %[[TMP_222:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_223:.*]] = mhlo.subtract %[[TMP_5]], %[[TMP_222]]
// CHECK: %[[TMP_224:.*]] = mhlo.multiply %[[TMP_221]], %[[TMP_223]]
// CHECK: %[[TMP_225:.*]] = mhlo.constant dense<-0.0013888888888888889>
// CHECK: %[[TMP_226:.*]] = mhlo.add %[[TMP_219]], %[[TMP_225]]
// CHECK: %[[TMP_227:.*]] = mhlo.multiply %[[TMP_129]], %[[TMP_226]]
// CHECK: %[[TMP_228:.*]] = mhlo.multiply %[[TMP_224]], %[[TMP_227]]
// CHECK: %[[TMP_229:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_230:.*]] = mhlo.divide %[[TMP_5]], %[[TMP_121]]
// CHECK: %[[TMP_231:.*]] = mhlo.constant dense<0.083333333333333329>
// CHECK: %[[TMP_232:.*]] = mhlo.add %[[TMP_231]], %[[TMP_228]]
// CHECK: %[[TMP_233:.*]] = mhlo.multiply %[[TMP_230]], %[[TMP_232]]
// CHECK: %[[TMP_234:.*]] = mhlo.add %[[TMP_229]], %[[TMP_233]]
// CHECK: %[[TMP_235:.*]] = mhlo.multiply %[[TMP_122]], %[[TMP_234]]
// CHECK: %[[TMP_236:.*]] = mhlo.add %[[TMP_127]], %[[TMP_235]]
// CHECK: %[[TMP_237:.*]] = "mhlo.abs"(%[[TMP_122]])
// CHECK: %[[TMP_238:.*]] = "mhlo.abs"(%[[TMP_120]])
// CHECK: %[[TMP_239:.*]] = mhlo.constant dense<4.940660e-324>
// CHECK: %[[TMP_240:.*]] = mhlo.multiply %[[TMP_238]], %[[TMP_239]]
// CHECK: %[[TMP_241:.*]] = "mhlo.compare"(%[[TMP_237]], %[[TMP_240]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_242:.*]] = "mhlo.select"(%[[TMP_241]], %[[TMP_120]], %[[TMP_236]])
// CHECK: %[[TMP_243:.*]] = mhlo.constant dense<0x7FF0000000000000>
// CHECK: %[[TMP_244:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_123]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_245:.*]] = "mhlo.select"(%[[TMP_244]], %[[TMP_243]], %[[TMP_242]])
// CHECK: %[[TMP_246:.*]] = mhlo.constant dense<0x7FF8000000000000>
// CHECK: %[[TMP_247:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_123]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_248:.*]] = "mhlo.select"(%[[TMP_247]], %[[TMP_246]], %[[TMP_245]])
// CHECK: %[[TMP_249:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_250:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_249]]) {comparison_direction = "LE"}
// CHECK: %[[TMP_251:.*]] = "mhlo.floor"(%[[TMP_5]])
// CHECK: %[[TMP_252:.*]] = "mhlo.compare"(%[[TMP_5]], %[[TMP_251]]) {comparison_direction = "NE"}
// CHECK: %[[TMP_253:.*]] = mhlo.and %[[TMP_250]], %[[TMP_252]]
// CHECK: %[[TMP_254:.*]] = "mhlo.floor"(%[[ARG1]])
// CHECK: %[[TMP_255:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_254]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_256:.*]] = mhlo.and %[[TMP_250]], %[[TMP_255]]
// CHECK: %[[TMP_257:.*]] = "mhlo.select"(%[[TMP_256]], %[[TMP_243]], %[[TMP_248]])
// CHECK: %[[TMP_258:.*]] = "mhlo.select"(%[[TMP_253]], %[[TMP_246]], %[[TMP_257]])
// CHECK: %[[TMP_259:.*]] = mhlo.multiply %[[TMP_4]], %[[TMP_89]]
// CHECK: %[[TMP_260:.*]] = mhlo.multiply %[[TMP_259]], %[[TMP_258]]
// CHECK: %[[TMP_261:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_262:.*]] = "mhlo.compare"(%[[ARG0]], %[[TMP_261]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_263:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_264:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_263]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_265:.*]] = "mhlo.negate"(%[[ARG1]])
// CHECK: %[[TMP_266:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_267:.*]] = mhlo.subtract %[[ARG1]], %[[TMP_266]]
// CHECK: %[[TMP_268:.*]] = "mhlo.select"(%[[TMP_264]], %[[TMP_265]], %[[TMP_267]])
// CHECK: %[[TMP_269:.*]] = mhlo.constant dense<0.000000e+00>
// CHECK: %[[TMP_270:.*]] = mhlo.constant dense<0.99999999999980993>
// CHECK: %[[TMP_271:.*]] = mhlo.constant dense<676.5203681218851>
// CHECK: %[[TMP_272:.*]] = mhlo.constant dense<1.000000e+00>
// CHECK: %[[TMP_273:.*]] = mhlo.add %[[TMP_268]], %[[TMP_272]]
// CHECK: %[[TMP_274:.*]] = mhlo.multiply %[[TMP_273]], %[[TMP_273]]
// CHECK: %[[TMP_275:.*]] = mhlo.divide %[[TMP_271]], %[[TMP_274]]
// CHECK: %[[TMP_276:.*]] = mhlo.subtract %[[TMP_269]], %[[TMP_275]]
// CHECK: %[[TMP_277:.*]] = mhlo.divide %[[TMP_271]], %[[TMP_273]]
// CHECK: %[[TMP_278:.*]] = mhlo.add %[[TMP_270]], %[[TMP_277]]
// CHECK: %[[TMP_279:.*]] = mhlo.constant dense<-1259.1392167224028>
// CHECK: %[[TMP_280:.*]] = mhlo.constant dense<2.000000e+00>
// CHECK: %[[TMP_281:.*]] = mhlo.add %[[TMP_268]], %[[TMP_280]]
// CHECK: %[[TMP_282:.*]] = mhlo.multiply %[[TMP_281]], %[[TMP_281]]
// CHECK: %[[TMP_283:.*]] = mhlo.divide %[[TMP_279]], %[[TMP_282]]
// CHECK: %[[TMP_284:.*]] = mhlo.subtract %[[TMP_276]], %[[TMP_283]]
// CHECK: %[[TMP_285:.*]] = mhlo.divide %[[TMP_279]], %[[TMP_281]]
// CHECK: %[[TMP_286:.*]] = mhlo.add %[[TMP_278]], %[[TMP_285]]
// CHECK: %[[TMP_287:.*]] = mhlo.constant dense<771.32342877765313>
// CHECK: %[[TMP_288:.*]] = mhlo.constant dense<3.000000e+00>
// CHECK: %[[TMP_289:.*]] = mhlo.add %[[TMP_268]], %[[TMP_288]]
// CHECK: %[[TMP_290:.*]] = mhlo.multiply %[[TMP_289]], %[[TMP_289]]
// CHECK: %[[TMP_291:.*]] = mhlo.divide %[[TMP_287]], %[[TMP_290]]
// CHECK: %[[TMP_292:.*]] = mhlo.subtract %[[TMP_284]], %[[TMP_291]]
// CHECK: %[[TMP_293:.*]] = mhlo.divide %[[TMP_287]], %[[TMP_289]]
// CHECK: %[[TMP_294:.*]] = mhlo.add %[[TMP_286]], %[[TMP_293]]
// CHECK: %[[TMP_295:.*]] = mhlo.constant dense<-176.61502916214059>
// CHECK: %[[TMP_296:.*]] = mhlo.constant dense<4.000000e+00>
// CHECK: %[[TMP_297:.*]] = mhlo.add %[[TMP_268]], %[[TMP_296]]
// CHECK: %[[TMP_298:.*]] = mhlo.multiply %[[TMP_297]], %[[TMP_297]]
// CHECK: %[[TMP_299:.*]] = mhlo.divide %[[TMP_295]], %[[TMP_298]]
// CHECK: %[[TMP_300:.*]] = mhlo.subtract %[[TMP_292]], %[[TMP_299]]
// CHECK: %[[TMP_301:.*]] = mhlo.divide %[[TMP_295]], %[[TMP_297]]
// CHECK: %[[TMP_302:.*]] = mhlo.add %[[TMP_294]], %[[TMP_301]]
// CHECK: %[[TMP_303:.*]] = mhlo.constant dense<12.507343278686905>
// CHECK: %[[TMP_304:.*]] = mhlo.constant dense<5.000000e+00>
// CHECK: %[[TMP_305:.*]] = mhlo.add %[[TMP_268]], %[[TMP_304]]
// CHECK: %[[TMP_306:.*]] = mhlo.multiply %[[TMP_305]], %[[TMP_305]]
// CHECK: %[[TMP_307:.*]] = mhlo.divide %[[TMP_303]], %[[TMP_306]]
// CHECK: %[[TMP_308:.*]] = mhlo.subtract %[[TMP_300]], %[[TMP_307]]
// CHECK: %[[TMP_309:.*]] = mhlo.divide %[[TMP_303]], %[[TMP_305]]
// CHECK: %[[TMP_310:.*]] = mhlo.add %[[TMP_302]], %[[TMP_309]]
// CHECK: %[[TMP_311:.*]] = mhlo.constant dense<-0.13857109526572012>
// CHECK: %[[TMP_312:.*]] = mhlo.constant dense<6.000000e+00>
// CHECK: %[[TMP_313:.*]] = mhlo.add %[[TMP_268]], %[[TMP_312]]
// CHECK: %[[TMP_314:.*]] = mhlo.multiply %[[TMP_313]], %[[TMP_313]]
// CHECK: %[[TMP_315:.*]] = mhlo.divide %[[TMP_311]], %[[TMP_314]]
// CHECK: %[[TMP_316:.*]] = mhlo.subtract %[[TMP_308]], %[[TMP_315]]
// CHECK: %[[TMP_317:.*]] = mhlo.divide %[[TMP_311]], %[[TMP_313]]
// CHECK: %[[TMP_318:.*]] = mhlo.add %[[TMP_310]], %[[TMP_317]]
// CHECK: %[[TMP_319:.*]] = mhlo.constant dense<9.9843695780195716E-6>
// CHECK: %[[TMP_320:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_321:.*]] = mhlo.add %[[TMP_268]], %[[TMP_320]]
// CHECK: %[[TMP_322:.*]] = mhlo.multiply %[[TMP_321]], %[[TMP_321]]
// CHECK: %[[TMP_323:.*]] = mhlo.divide %[[TMP_319]], %[[TMP_322]]
// CHECK: %[[TMP_324:.*]] = mhlo.subtract %[[TMP_316]], %[[TMP_323]]
// CHECK: %[[TMP_325:.*]] = mhlo.divide %[[TMP_319]], %[[TMP_321]]
// CHECK: %[[TMP_326:.*]] = mhlo.add %[[TMP_318]], %[[TMP_325]]
// CHECK: %[[TMP_327:.*]] = mhlo.constant dense<1.5056327351493116E-7>
// CHECK: %[[TMP_328:.*]] = mhlo.constant dense<8.000000e+00>
// CHECK: %[[TMP_329:.*]] = mhlo.add %[[TMP_268]], %[[TMP_328]]
// CHECK: %[[TMP_330:.*]] = mhlo.multiply %[[TMP_329]], %[[TMP_329]]
// CHECK: %[[TMP_331:.*]] = mhlo.divide %[[TMP_327]], %[[TMP_330]]
// CHECK: %[[TMP_332:.*]] = mhlo.subtract %[[TMP_324]], %[[TMP_331]]
// CHECK: %[[TMP_333:.*]] = mhlo.divide %[[TMP_327]], %[[TMP_329]]
// CHECK: %[[TMP_334:.*]] = mhlo.add %[[TMP_326]], %[[TMP_333]]
// CHECK: %[[TMP_335:.*]] = mhlo.constant dense<7.500000e+00>
// CHECK: %[[TMP_336:.*]] = mhlo.add %[[TMP_335]], %[[TMP_268]]
// CHECK: %[[TMP_337:.*]] = mhlo.constant dense<2.0149030205422647>
// CHECK: %[[TMP_338:.*]] = mhlo.divide %[[TMP_268]], %[[TMP_335]]
// CHECK: %[[TMP_339:.*]] = "mhlo.log_plus_one"(%[[TMP_338]])
// CHECK: %[[TMP_340:.*]] = mhlo.add %[[TMP_337]], %[[TMP_339]]
// CHECK: %[[TMP_341:.*]] = mhlo.divide %[[TMP_332]], %[[TMP_334]]
// CHECK: %[[TMP_342:.*]] = mhlo.constant dense<7.000000e+00>
// CHECK: %[[TMP_343:.*]] = mhlo.divide %[[TMP_342]], %[[TMP_336]]
// CHECK: %[[TMP_344:.*]] = mhlo.add %[[TMP_340]], %[[TMP_341]]
// CHECK: %[[TMP_345:.*]] = mhlo.subtract %[[TMP_344]], %[[TMP_343]]
// CHECK: %[[TMP_346:.*]] = mhlo.constant dense<5.000000e-01>
// CHECK: %[[TMP_347:.*]] = mhlo.add %[[ARG1]], %[[TMP_346]]
// CHECK: %[[TMP_348:.*]] = "mhlo.floor"(%[[TMP_347]])
// CHECK: %[[TMP_349:.*]] = "mhlo.abs"(%[[TMP_348]])
// CHECK: %[[TMP_350:.*]] = mhlo.add %[[ARG1]], %[[TMP_349]]
// CHECK: %[[TMP_351:.*]] = mhlo.constant dense<3.1415926535897931>
// CHECK: %[[TMP_352:.*]] = mhlo.multiply %[[TMP_351]], %[[TMP_350]]
// CHECK: %[[TMP_353:.*]] = "mhlo.cosine"(%[[TMP_352]])
// CHECK: %[[TMP_354:.*]] = "mhlo.sine"(%[[TMP_352]])
// CHECK: %[[TMP_355:.*]] = mhlo.multiply %[[TMP_351]], %[[TMP_353]]
// CHECK: %[[TMP_356:.*]] = mhlo.divide %[[TMP_355]], %[[TMP_354]]
// CHECK: %[[TMP_357:.*]] = mhlo.subtract %[[TMP_345]], %[[TMP_356]]
// CHECK: %[[TMP_358:.*]] = "mhlo.select"(%[[TMP_264]], %[[TMP_357]], %[[TMP_345]])
// CHECK: %[[TMP_359:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_269]]) {comparison_direction = "LE"}
// CHECK: %[[TMP_360:.*]] = "mhlo.floor"(%[[ARG1]])
// CHECK: %[[TMP_361:.*]] = "mhlo.compare"(%[[ARG1]], %[[TMP_360]]) {comparison_direction = "EQ"}
// CHECK: %[[TMP_362:.*]] = mhlo.and %[[TMP_359]], %[[TMP_361]]
// CHECK: %[[TMP_363:.*]] = mhlo.constant dense<0x7FF8000000000000>
// CHECK: %[[TMP_364:.*]] = "mhlo.select"(%[[TMP_362]], %[[TMP_363]], %[[TMP_358]])
// CHECK: %[[TMP_365:.*]] = "mhlo.select"(%[[TMP_262]], %[[TMP_364]], %[[TMP_260]])
// CHECK: %[[TMP_366:.*]] = "mhlo.floor"(%[[ARG0]])
// CHECK: %[[TMP_367:.*]] = "mhlo.compare"(%[[ARG0]], %[[TMP_366]]) {comparison_direction = "NE"}
// CHECK: %[[TMP_368:.*]] = "mhlo.compare"(%[[ARG0]], %[[TMP_261]]) {comparison_direction = "LT"}
// CHECK: %[[TMP_369:.*]] = mhlo.or %[[TMP_367]], %[[TMP_368]]
// CHECK: %[[TMP_370:.*]] = mhlo.constant dense<0x7FF8000000000000>
// CHECK: %[[TMP_371:.*]] = "mhlo.select"(%[[TMP_369]], %[[TMP_370]], %[[TMP_365]])
// CHECK: return %[[TMP_371]]
%1 = chlo.polygamma %lhs, %rhs : tensor<f64>, tensor<f64> -> tensor<f64>
return %1 : tensor<f64>
}
// CHECK-LABEL: @polygamma_f16
// CHECK-SAME: (%[[LHS:.*]]: tensor<f16>, %[[RHS:.*]]: tensor<f16>)
func @polygamma_f16(%lhs : tensor<f16>, %rhs : tensor<f16>) -> tensor<f16> {
// CHECK: "mhlo.convert"(%[[LHS]]) : (tensor<f16>) -> tensor<f32>
// CHECK: "mhlo.convert"(%[[RHS]]) : (tensor<f16>) -> tensor<f32>
// CHECK: %[[RES:.*]] = "mhlo.convert"(%{{.*}}) : (tensor<f32>) -> tensor<f16>
// CHECK: return %[[RES]]
%1 = chlo.polygamma %lhs, %rhs : tensor<f16>, tensor<f16> -> tensor<f16>
return %1 : tensor<f16>
}