forked from OSchip/llvm-project
[fir] Remove obsolete fir.negf and fir.modf ops
fir.negf op is replaced by mlir.negf and fir.modf is just deleted. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D110932 Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Valentin Clement <clementval@gmail.com>
This commit is contained in:
parent
05ba9ff6a6
commit
2372249d86
|
@ -2425,18 +2425,6 @@ class fir_UnaryArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
|
|||
let printer = [{ return printUnaryOp(this->getOperation(), p); }];
|
||||
}
|
||||
|
||||
class RealUnaryArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
|
||||
fir_UnaryArithmeticOp<mnemonic, traits>,
|
||||
Arguments<(ins AnyRealLike:$operand)>;
|
||||
|
||||
def fir_NegfOp : RealUnaryArithmeticOp<"negf">;
|
||||
|
||||
class RealArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
|
||||
fir_ArithmeticOp<mnemonic, traits>,
|
||||
Arguments<(ins AnyRealLike:$lhs, AnyRealLike:$rhs)>;
|
||||
|
||||
def fir_ModfOp : RealArithmeticOp<"modf">;
|
||||
|
||||
def fir_ConstcOp : fir_Op<"constc", [NoSideEffect]> {
|
||||
let summary = "create a complex constant";
|
||||
|
||||
|
|
|
@ -1021,7 +1021,7 @@ mlir::Value IntrinsicLibrary::genConjg(mlir::Type resultType,
|
|||
auto imag =
|
||||
Fortran::lower::ComplexExprHelper{builder, loc}.extractComplexPart(
|
||||
cplx, /*isImagPart=*/true);
|
||||
auto negImag = builder.create<fir::NegfOp>(loc, imag);
|
||||
auto negImag = builder.create<mlir::NegFOp>(loc, imag);
|
||||
return Fortran::lower::ComplexExprHelper{builder, loc}.insertComplexPart(
|
||||
cplx, negImag, /*isImagPart=*/true);
|
||||
}
|
||||
|
@ -1187,7 +1187,7 @@ mlir::Value IntrinsicLibrary::genSign(mlir::Type resultType,
|
|||
// TODO: Requirements when second argument is +0./0.
|
||||
auto zeroAttr = builder.getZeroAttr(resultType);
|
||||
auto zero = builder.create<mlir::ConstantOp>(loc, resultType, zeroAttr);
|
||||
auto neg = builder.create<fir::NegfOp>(loc, abs);
|
||||
auto neg = builder.create<mlir::NegFOp>(loc, abs);
|
||||
auto cmp = builder.create<mlir::CmpFOp>(loc, mlir::CmpFPredicate::OLT,
|
||||
args[1], zero);
|
||||
return builder.create<mlir::SelectOp>(loc, cmp, neg, abs);
|
||||
|
|
|
@ -491,23 +491,21 @@ func @arith_real(%a : f128, %b : f128) -> f128 {
|
|||
|
||||
// CHECK: [[VAL_171:%.*]] = constant 1.0
|
||||
// CHECK: [[VAL_172:%.*]] = fir.convert [[VAL_171]] : (f32) -> f128
|
||||
// CHECK: [[VAL_173:%.*]] = fir.negf [[VAL_169]] : f128
|
||||
// CHECK: [[VAL_173:%.*]] = negf [[VAL_169]] : f128
|
||||
// CHECK: [[VAL_174:%.*]] = addf [[VAL_172]], [[VAL_173]] : f128
|
||||
// CHECK: [[VAL_175:%.*]] = subf [[VAL_174]], [[VAL_170]] : f128
|
||||
// CHECK: [[VAL_176:%.*]] = mulf [[VAL_173]], [[VAL_175]] : f128
|
||||
// CHECK: [[VAL_177:%.*]] = divf [[VAL_176]], [[VAL_169]] : f128
|
||||
// CHECK: [[VAL_178:%.*]] = fir.modf [[VAL_177]], [[VAL_170]] : f128
|
||||
%c1 = constant 1.0 : f32
|
||||
%0 = fir.convert %c1 : (f32) -> f128
|
||||
%1 = fir.negf %a : f128
|
||||
%1 = negf %a : f128
|
||||
%2 = addf %0, %1 : f128
|
||||
%3 = subf %2, %b : f128
|
||||
%4 = mulf %1, %3 : f128
|
||||
%5 = divf %4, %a : f128
|
||||
%6 = fir.modf %5, %b : f128
|
||||
// CHECK: return [[VAL_178]] : f128
|
||||
// CHECK: return [[VAL_177]] : f128
|
||||
// CHECK: }
|
||||
return %6 : f128
|
||||
return %5 : f128
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @arith_complex(
|
||||
|
|
Loading…
Reference in New Issue