[PATCH] D110932: [fir] Remove obsolete fir.negf and fir.modf ops
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 1 06:29:44 PDT 2021
clementval created this revision.
clementval added reviewers: jeanPerier, svedanayagam, sscalpone, kiranchandramohan, jdoerfert, schweitz, pmccormick, mehdi_amini, rovka, AlexisPerry.
Herald added subscribers: Chia-hungDuan, rriddle.
Herald added a project: Flang.
clementval requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer.
Herald added a project: LLVM.
fir.negf op is replaced by mlir.negf and
fir.modf is just deleted.
Co-authored-by: Jean Perier <jperier at nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz at nvidia.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110932
Files:
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Lower/IntrinsicCall.cpp
flang/test/Fir/fir-ops.fir
Index: flang/test/Fir/fir-ops.fir
===================================================================
--- flang/test/Fir/fir-ops.fir
+++ flang/test/Fir/fir-ops.fir
@@ -491,23 +491,21 @@
// 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(
Index: flang/lib/Lower/IntrinsicCall.cpp
===================================================================
--- flang/lib/Lower/IntrinsicCall.cpp
+++ flang/lib/Lower/IntrinsicCall.cpp
@@ -1021,7 +1021,7 @@
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 @@
// 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);
Index: flang/include/flang/Optimizer/Dialect/FIROps.td
===================================================================
--- flang/include/flang/Optimizer/Dialect/FIROps.td
+++ flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2425,18 +2425,6 @@
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";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110932.376505.patch
Type: text/x-patch
Size: 3126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/29c0369c/attachment.bin>
More information about the llvm-commits
mailing list