@@ -94,34 +94,35 @@ struct Atan2OpConversion : public OpConversionPattern<complex::Atan2Op> {
94
94
95
95
auto type = cast<ComplexType>(op.getType ());
96
96
Type elementType = type.getElementType ();
97
+ arith::FastMathFlagsAttr fmf = op.getFastMathFlagsAttr ();
97
98
98
99
Value lhs = adaptor.getLhs ();
99
100
Value rhs = adaptor.getRhs ();
100
101
101
- Value rhsSquared = b.create <complex::MulOp>(type, rhs, rhs);
102
- Value lhsSquared = b.create <complex::MulOp>(type, lhs, lhs);
102
+ Value rhsSquared = b.create <complex::MulOp>(type, rhs, rhs, fmf );
103
+ Value lhsSquared = b.create <complex::MulOp>(type, lhs, lhs, fmf );
103
104
Value rhsSquaredPlusLhsSquared =
104
- b.create <complex::AddOp>(type, rhsSquared, lhsSquared);
105
+ b.create <complex::AddOp>(type, rhsSquared, lhsSquared, fmf );
105
106
Value sqrtOfRhsSquaredPlusLhsSquared =
106
- b.create <complex::SqrtOp>(type, rhsSquaredPlusLhsSquared);
107
+ b.create <complex::SqrtOp>(type, rhsSquaredPlusLhsSquared, fmf );
107
108
108
109
Value zero =
109
110
b.create <arith::ConstantOp>(elementType, b.getZeroAttr (elementType));
110
111
Value one = b.create <arith::ConstantOp>(elementType,
111
112
b.getFloatAttr (elementType, 1 ));
112
113
Value i = b.create <complex::CreateOp>(type, zero, one);
113
- Value iTimesLhs = b.create <complex::MulOp>(i, lhs);
114
- Value rhsPlusILhs = b.create <complex::AddOp>(rhs, iTimesLhs);
114
+ Value iTimesLhs = b.create <complex::MulOp>(i, lhs, fmf );
115
+ Value rhsPlusILhs = b.create <complex::AddOp>(rhs, iTimesLhs, fmf );
115
116
116
- Value divResult =
117
- b. create <complex::DivOp>( rhsPlusILhs, sqrtOfRhsSquaredPlusLhsSquared);
118
- Value logResult = b.create <complex::LogOp>(divResult);
117
+ Value divResult = b. create <complex::DivOp>(
118
+ rhsPlusILhs, sqrtOfRhsSquaredPlusLhsSquared, fmf );
119
+ Value logResult = b.create <complex::LogOp>(divResult, fmf );
119
120
120
121
Value negativeOne = b.create <arith::ConstantOp>(
121
122
elementType, b.getFloatAttr (elementType, -1 ));
122
123
Value negativeI = b.create <complex::CreateOp>(type, zero, negativeOne);
123
124
124
- rewriter.replaceOpWithNewOp <complex::MulOp>(op, negativeI, logResult);
125
+ rewriter.replaceOpWithNewOp <complex::MulOp>(op, negativeI, logResult, fmf );
125
126
return success ();
126
127
}
127
128
};
0 commit comments