@@ -424,8 +424,8 @@ class ScalarExprLowering {
424
424
}
425
425
426
426
template <typename OpTy>
427
- mlir::Value createCompareOp (mlir::arith::CmpIPredicate pred, const ExtValue &left,
428
- const ExtValue &right) {
427
+ mlir::Value createCompareOp (mlir::arith::CmpIPredicate pred,
428
+ const ExtValue &left, const ExtValue & right) {
429
429
if (auto *lhs = left.getUnboxed ())
430
430
if (auto *rhs = right.getUnboxed ())
431
431
return builder.create <OpTy>(getLoc (), pred, *lhs, *rhs);
@@ -438,8 +438,8 @@ class ScalarExprLowering {
438
438
}
439
439
440
440
template <typename OpTy>
441
- mlir::Value createFltCmpOp (mlir::arith::CmpFPredicate pred, const ExtValue &left,
442
- const ExtValue &right) {
441
+ mlir::Value createFltCmpOp (mlir::arith::CmpFPredicate pred,
442
+ const ExtValue &left, const ExtValue & right) {
443
443
if (auto *lhs = left.getUnboxed ())
444
444
if (auto *rhs = right.getUnboxed ())
445
445
return builder.create <OpTy>(getLoc (), pred, *lhs, *rhs);
@@ -453,8 +453,8 @@ class ScalarExprLowering {
453
453
454
454
// / Create a call to the runtime to compare two CHARACTER values.
455
455
// / Precondition: This assumes that the two values have `fir.boxchar` type.
456
- mlir::Value createCharCompare (mlir::arith::CmpIPredicate pred, const ExtValue &left,
457
- const ExtValue &right) {
456
+ mlir::Value createCharCompare (mlir::arith::CmpIPredicate pred,
457
+ const ExtValue &left, const ExtValue & right) {
458
458
return fir::runtime::genCharCompare (builder, getLoc (), pred, left, right);
459
459
}
460
460
@@ -879,12 +879,14 @@ class ScalarExprLowering {
879
879
template <int KIND>
880
880
ExtValue genval (const Fortran::evaluate::Relational<Fortran::evaluate::Type<
881
881
Fortran::common::TypeCategory::Integer, KIND>> &op) {
882
- return createCompareOp<mlir::arith::CmpIOp>(op, translateRelational (op.opr ));
882
+ return createCompareOp<mlir::arith::CmpIOp>(op,
883
+ translateRelational (op.opr ));
883
884
}
884
885
template <int KIND>
885
886
ExtValue genval (const Fortran::evaluate::Relational<Fortran::evaluate::Type<
886
887
Fortran::common::TypeCategory::Real, KIND>> &op) {
887
- return createFltCmpOp<mlir::arith::CmpFOp>(op, translateFloatRelational (op.opr ));
888
+ return createFltCmpOp<mlir::arith::CmpFOp>(
889
+ op, translateFloatRelational (op.opr ));
888
890
}
889
891
template <int KIND>
890
892
ExtValue genval (const Fortran::evaluate::Relational<Fortran::evaluate::Type<
@@ -942,9 +944,11 @@ class ScalarExprLowering {
942
944
case Fortran::evaluate::LogicalOperator::Or:
943
945
return createBinaryOp<mlir::arith::OrIOp>(lhs, rhs);
944
946
case Fortran::evaluate::LogicalOperator::Eqv:
945
- return createCompareOp<mlir::arith::CmpIOp>(mlir::arith::CmpIPredicate::eq, lhs, rhs);
947
+ return createCompareOp<mlir::arith::CmpIOp>(
948
+ mlir::arith::CmpIPredicate::eq, lhs, rhs);
946
949
case Fortran::evaluate::LogicalOperator::Neqv:
947
- return createCompareOp<mlir::arith::CmpIOp>(mlir::arith::CmpIPredicate::ne, lhs, rhs);
950
+ return createCompareOp<mlir::arith::CmpIOp>(
951
+ mlir::arith::CmpIPredicate::ne, lhs, rhs);
948
952
case Fortran::evaluate::LogicalOperator::Not:
949
953
// lib/evaluate expression for .NOT. is Fortran::evaluate::Not<KIND>.
950
954
llvm_unreachable (" .NOT. is not a binary operator" );
@@ -3119,9 +3123,11 @@ class ScalarArrayExprLowering {
3119
3123
case Fortran::evaluate::LogicalOperator::Or:
3120
3124
return createBinaryBoolOp<mlir::arith::OrIOp>(x);
3121
3125
case Fortran::evaluate::LogicalOperator::Eqv:
3122
- return createCompareBoolOp<mlir::arith::CmpIOp>(mlir::arith::CmpIPredicate::eq, x);
3126
+ return createCompareBoolOp<mlir::arith::CmpIOp>(
3127
+ mlir::arith::CmpIPredicate::eq, x);
3123
3128
case Fortran::evaluate::LogicalOperator::Neqv:
3124
- return createCompareBoolOp<mlir::arith::CmpIOp>(mlir::arith::CmpIPredicate::ne, x);
3129
+ return createCompareBoolOp<mlir::arith::CmpIOp>(
3130
+ mlir::arith::CmpIPredicate::ne, x);
3125
3131
case Fortran::evaluate::LogicalOperator::Not:
3126
3132
llvm_unreachable (" .NOT. handled elsewhere" );
3127
3133
}
@@ -3156,7 +3162,8 @@ class ScalarArrayExprLowering {
3156
3162
ExtValue
3157
3163
gen (const Fortran::evaluate::Relational<
3158
3164
Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, KIND>> &x) {
3159
- return createCompareOp<mlir::arith::CmpFOp>(translateFloatRelational (x.opr ), x);
3165
+ return createCompareOp<mlir::arith::CmpFOp>(translateFloatRelational (x.opr ),
3166
+ x);
3160
3167
}
3161
3168
template <int KIND>
3162
3169
ExtValue gen (const Fortran::evaluate::Relational<Fortran::evaluate::Type<
@@ -4043,8 +4050,8 @@ class ArrayExprLowering {
4043
4050
// Compute the dynamic position into the header.
4044
4051
llvm::SmallVector<mlir::Value> offsets;
4045
4052
for (auto doLoop : loopStack[i]) {
4046
- auto m = builder.create <mlir::arith::SubIOp>(loc, doLoop. getInductionVar (),
4047
- doLoop.lowerBound ());
4053
+ auto m = builder.create <mlir::arith::SubIOp>(
4054
+ loc, doLoop. getInductionVar (), doLoop.lowerBound ());
4048
4055
auto n = builder.create <mlir::arith::DivSIOp>(loc, m, doLoop.step ());
4049
4056
auto one = builder.createIntegerConstant (loc, n.getType (), 1 );
4050
4057
offsets.push_back (builder.create <mlir::arith::AddIOp>(loc, n, one));
@@ -4166,7 +4173,8 @@ class ArrayExprLowering {
4166
4173
// Convert any implied shape to closed interval form. The fir.do_loop will
4167
4174
// run from 0 to `extent - 1` inclusive.
4168
4175
for (auto extent : shape)
4169
- loopUppers.push_back (builder.create <mlir::arith::SubIOp>(loc, extent, one));
4176
+ loopUppers.push_back (
4177
+ builder.create <mlir::arith::SubIOp>(loc, extent, one));
4170
4178
4171
4179
// Iteration space is created with outermost columns, innermost rows
4172
4180
llvm::SmallVector<fir::DoLoopOp> loops;
@@ -5120,8 +5128,8 @@ class ArrayExprLowering {
5120
5128
loc, resTy, arrLd, mlir::ValueRange{iter},
5121
5129
arrLdTypeParams);
5122
5130
auto cast = builder.createConvert (loc, idxTy, fetch);
5123
- auto val =
5124
- builder. create <mlir::arith::SubIOp>(loc, idxTy, cast, lb);
5131
+ auto val = builder. create <mlir::arith::SubIOp>(loc, idxTy,
5132
+ cast, lb);
5125
5133
newIters.setIndexValue (dim, val);
5126
5134
return newIters;
5127
5135
};
@@ -5310,9 +5318,10 @@ class ArrayExprLowering {
5310
5318
// Convert the upper bound to a length.
5311
5319
auto cast = builder.createConvert (loc, iTy, substringBounds[1 ]);
5312
5320
auto zero = builder.createIntegerConstant (loc, iTy, 0 );
5313
- auto size = builder.create <mlir::arith::SubIOp>(loc, cast, substringBounds[0 ]);
5314
- auto cmp = builder.create <mlir::arith::CmpIOp>(loc, mlir::arith::CmpIPredicate::sgt,
5315
- size, zero);
5321
+ auto size =
5322
+ builder.create <mlir::arith::SubIOp>(loc, cast, substringBounds[0 ]);
5323
+ auto cmp = builder.create <mlir::arith::CmpIOp>(
5324
+ loc, mlir::arith::CmpIPredicate::sgt, size, zero);
5316
5325
// size = MAX(upper - (lower - 1), 0)
5317
5326
substringBounds[1 ] =
5318
5327
builder.create <mlir::SelectOp>(loc, cmp, size, zero);
@@ -5695,8 +5704,8 @@ class ArrayExprLowering {
5695
5704
mlir::Value eleSz) {
5696
5705
auto loc = getLoc ();
5697
5706
auto reallocFunc = fir::factory::getRealloc (builder);
5698
- auto cond = builder.create <mlir::arith::CmpIOp>(loc, mlir::arith::CmpIPredicate::sle,
5699
- bufferSize, needed);
5707
+ auto cond = builder.create <mlir::arith::CmpIOp>(
5708
+ loc, mlir::arith::CmpIPredicate::sle, bufferSize, needed);
5700
5709
auto ifOp = builder.create <fir::IfOp>(loc, mem.getType (), cond,
5701
5710
/* withElseRegion=*/ true );
5702
5711
auto insPt = builder.saveInsertionPoint ();
@@ -5790,7 +5799,8 @@ class ArrayExprLowering {
5790
5799
mem = growBuffer (mem, endOff, limit, buffSize, eleSz);
5791
5800
5792
5801
// Copy the elements to the buffer.
5793
- mlir::Value byteSz = builder.create <mlir::arith::MulIOp>(loc, arrSz, eleSz);
5802
+ mlir::Value byteSz =
5803
+ builder.create <mlir::arith::MulIOp>(loc, arrSz, eleSz);
5794
5804
auto buff = builder.createConvert (loc, fir::HeapType::get (resTy), mem);
5795
5805
auto buffi = computeCoordinate (buff, off);
5796
5806
auto args = fir::runtime::createArguments (
@@ -6064,9 +6074,11 @@ class ArrayExprLowering {
6064
6074
case Fortran::evaluate::LogicalOperator::Or:
6065
6075
return createBinaryBoolOp<mlir::arith::OrIOp>(x);
6066
6076
case Fortran::evaluate::LogicalOperator::Eqv:
6067
- return createCompareBoolOp<mlir::arith::CmpIOp>(mlir::arith::CmpIPredicate::eq, x);
6077
+ return createCompareBoolOp<mlir::arith::CmpIOp>(
6078
+ mlir::arith::CmpIPredicate::eq, x);
6068
6079
case Fortran::evaluate::LogicalOperator::Neqv:
6069
- return createCompareBoolOp<mlir::arith::CmpIOp>(mlir::arith::CmpIPredicate::ne, x);
6080
+ return createCompareBoolOp<mlir::arith::CmpIOp>(
6081
+ mlir::arith::CmpIPredicate::ne, x);
6070
6082
case Fortran::evaluate::LogicalOperator::Not:
6071
6083
llvm_unreachable (" .NOT. handled elsewhere" );
6072
6084
}
@@ -6112,7 +6124,8 @@ class ArrayExprLowering {
6112
6124
template <int KIND>
6113
6125
CC genarr (const Fortran::evaluate::Relational<Fortran::evaluate::Type<
6114
6126
Fortran::common::TypeCategory::Real, KIND>> &x) {
6115
- return createCompareOp<mlir::arith::CmpFOp>(translateFloatRelational (x.opr ), x);
6127
+ return createCompareOp<mlir::arith::CmpFOp>(translateFloatRelational (x.opr ),
6128
+ x);
6116
6129
}
6117
6130
template <int KIND>
6118
6131
CC genarr (const Fortran::evaluate::Relational<Fortran::evaluate::Type<
@@ -6179,7 +6192,8 @@ class ArrayExprLowering {
6179
6192
auto step = builder.createConvert (loc, idxTy, stride);
6180
6193
auto prod =
6181
6194
builder.create <mlir::arith::MulIOp>(loc, impliedIter, step);
6182
- auto trip = builder.create <mlir::arith::AddIOp>(loc, initial, prod);
6195
+ auto trip =
6196
+ builder.create <mlir::arith::AddIOp>(loc, initial, prod);
6183
6197
return trip;
6184
6198
}},
6185
6199
sub.u );
0 commit comments