return false;
}
-static mlir::Value
-genReductionInitValue(fir::FirOpBuilder &builder, mlir::Location loc,
- mlir::Type ty, mlir::acc::ReductionOperator op,
- llvm::SmallVector<mlir::Value> &bounds) {
+/// Return a constant with the initial value for the reduction operator and
+/// type combination.
+static mlir::Value getReductionInitValue(fir::FirOpBuilder &builder,
+ mlir::Location loc, mlir::Type ty,
+ mlir::acc::ReductionOperator op) {
if (op == mlir::acc::ReductionOperator::AccLand ||
op == mlir::acc::ReductionOperator::AccLor ||
op == mlir::acc::ReductionOperator::AccEqv ||
return fir::factory::Complex{builder, loc}.createComplex(
cmplxTy.getFKind(), realInit, imagInit);
}
- if (auto refTy = mlir::dyn_cast<fir::ReferenceType>(ty)) {
- if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(refTy.getEleTy())) {
- mlir::Type vecTy =
- mlir::VectorType::get(seqTy.getShape(), seqTy.getEleTy());
- auto shTy = vecTy.cast<mlir::ShapedType>();
- if (seqTy.getEleTy().isIntOrIndex())
- return builder.create<mlir::arith::ConstantOp>(
- loc, vecTy,
- mlir::DenseElementsAttr::get(
- shTy,
- getReductionInitValue<llvm::APInt>(op, seqTy.getEleTy())));
- if (mlir::isa<mlir::FloatType>(seqTy.getEleTy()))
- return builder.create<mlir::arith::ConstantOp>(
- loc, vecTy,
- mlir::DenseElementsAttr::get(
- shTy,
- getReductionInitValue<llvm::APFloat>(op, seqTy.getEleTy())));
+
+ if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(ty))
+ return getReductionInitValue(builder, loc, seqTy.getEleTy(), op);
+
+ llvm::report_fatal_error("Unsupported OpenACC reduction type");
+}
+
+static mlir::Value genReductionInitRegion(fir::FirOpBuilder &builder,
+ mlir::Location loc, mlir::Type ty,
+ mlir::acc::ReductionOperator op) {
+ ty = fir::unwrapRefType(ty);
+ mlir::Value initValue = getReductionInitValue(builder, loc, ty, op);
+ if (fir::isa_trivial(ty)) {
+ mlir::Value alloca = builder.create<fir::AllocaOp>(loc, ty);
+ builder.create<fir::StoreOp>(loc, builder.createConvert(loc, ty, initValue),
+ alloca);
+ return alloca;
+ } else if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(ty)) {
+ if (seqTy.hasDynamicExtents())
+ TODO(loc, "private recipe of array with dynamic extents");
+ if (fir::isa_trivial(seqTy.getEleTy())) {
+ mlir::Value alloca = builder.create<fir::AllocaOp>(loc, seqTy);
+ mlir::Type idxTy = builder.getIndexType();
+ mlir::Type refTy = fir::ReferenceType::get(seqTy.getEleTy());
+ llvm::SmallVector<fir::DoLoopOp> loops;
+ llvm::SmallVector<mlir::Value> ivs;
+ for (auto ext : llvm::reverse(seqTy.getShape())) {
+ auto lb = builder.createIntegerConstant(loc, idxTy, 0);
+ auto ub = builder.createIntegerConstant(loc, idxTy, ext - 1);
+ auto step = builder.createIntegerConstant(loc, idxTy, 1);
+ auto loop = builder.create<fir::DoLoopOp>(loc, lb, ub, step,
+ /*unordered=*/false);
+ builder.setInsertionPointToStart(loop.getBody());
+ loops.push_back(loop);
+ ivs.push_back(loop.getInductionVar());
+ }
+ auto coord = builder.create<fir::CoordinateOp>(loc, refTy, alloca, ivs);
+ builder.create<fir::StoreOp>(loc, initValue, coord);
+ builder.setInsertionPointAfter(loops[0]);
+ return alloca;
}
}
-
llvm::report_fatal_error("Unsupported OpenACC reduction type");
}
mlir::Type i1 = builder.getI1Type();
mlir::Value v1 = builder.create<fir::ConvertOp>(loc, i1, value1);
mlir::Value v2 = builder.create<fir::ConvertOp>(loc, i1, value2);
- mlir::Value add = builder.create<Op>(loc, v1, v2);
- return builder.create<fir::ConvertOp>(loc, value1.getType(), add);
+ mlir::Value combined = builder.create<Op>(loc, v1, v2);
+ return builder.create<fir::ConvertOp>(loc, value1.getType(), combined);
+}
+
+static mlir::Value loadIfRef(fir::FirOpBuilder &builder, mlir::Location loc,
+ mlir::Value value) {
+ if (mlir::isa<fir::ReferenceType, fir::PointerType, fir::HeapType>(
+ value.getType()))
+ return builder.create<fir::LoadOp>(loc, value);
+ return value;
}
static mlir::Value genComparisonCombiner(fir::FirOpBuilder &builder,
return builder.create<fir::ConvertOp>(loc, value1.getType(), add);
}
-static mlir::Value genCombiner(fir::FirOpBuilder &builder, mlir::Location loc,
- mlir::acc::ReductionOperator op, mlir::Type ty,
- mlir::Value value1, mlir::Value value2) {
-
- // Handle combiner on arrays.
- if (auto refTy = mlir::dyn_cast<fir::ReferenceType>(ty)) {
- if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(refTy.getEleTy())) {
- if (seqTy.hasDynamicExtents())
- TODO(loc, "OpenACC reduction on array with dynamic extents");
- mlir::Type idxTy = builder.getIndexType();
- mlir::Type refTy = fir::ReferenceType::get(seqTy.getEleTy());
-
- llvm::SmallVector<fir::DoLoopOp> loops;
- llvm::SmallVector<mlir::Value> ivs;
- for (auto ext : llvm::reverse(seqTy.getShape())) {
- auto lb = builder.create<mlir::arith::ConstantOp>(
- loc, idxTy, builder.getIntegerAttr(idxTy, 0));
- auto ub = builder.create<mlir::arith::ConstantOp>(
- loc, idxTy, builder.getIntegerAttr(idxTy, ext - 1));
- auto step = builder.create<mlir::arith::ConstantOp>(
- loc, idxTy, builder.getIntegerAttr(idxTy, 1));
- auto loop = builder.create<fir::DoLoopOp>(loc, lb, ub, step,
- /*unordered=*/false);
- builder.setInsertionPointToStart(loop.getBody());
- loops.push_back(loop);
- ivs.push_back(loop.getInductionVar());
- }
- auto addr1 = builder.create<fir::CoordinateOp>(loc, refTy, value1, ivs);
- auto addr2 = builder.create<fir::CoordinateOp>(loc, refTy, value2, ivs);
- auto load1 = builder.create<fir::LoadOp>(loc, addr1);
- auto load2 = builder.create<fir::LoadOp>(loc, addr2);
- auto combined =
- genCombiner(builder, loc, op, seqTy.getEleTy(), load1, load2);
- builder.create<fir::StoreOp>(loc, combined, addr1);
- builder.setInsertionPointAfter(loops[0]);
- return value1;
- }
- }
-
+static mlir::Value genScalarCombiner(fir::FirOpBuilder &builder,
+ mlir::Location loc,
+ mlir::acc::ReductionOperator op,
+ mlir::Type ty, mlir::Value value1,
+ mlir::Value value2) {
+ value1 = loadIfRef(builder, loc, value1);
+ value2 = loadIfRef(builder, loc, value2);
if (op == mlir::acc::ReductionOperator::AccAdd) {
if (ty.isIntOrIndex())
return builder.create<mlir::arith::AddIOp>(loc, value1, value2);
TODO(loc, "reduction operator");
}
+static void genCombiner(fir::FirOpBuilder &builder, mlir::Location loc,
+ mlir::acc::ReductionOperator op, mlir::Type ty,
+ mlir::Value value1, mlir::Value value2) {
+ ty = fir::unwrapRefType(ty);
+
+ if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(ty)) {
+ if (seqTy.hasDynamicExtents())
+ TODO(loc, "OpenACC reduction on array with dynamic extents");
+ mlir::Type idxTy = builder.getIndexType();
+ mlir::Type refTy = fir::ReferenceType::get(seqTy.getEleTy());
+
+ llvm::SmallVector<fir::DoLoopOp> loops;
+ llvm::SmallVector<mlir::Value> ivs;
+ for (auto ext : llvm::reverse(seqTy.getShape())) {
+ auto lb = builder.createIntegerConstant(loc, idxTy, 0);
+ auto ub = builder.createIntegerConstant(loc, idxTy, ext - 1);
+ auto step = builder.createIntegerConstant(loc, idxTy, 1);
+ auto loop = builder.create<fir::DoLoopOp>(loc, lb, ub, step,
+ /*unordered=*/false);
+ builder.setInsertionPointToStart(loop.getBody());
+ loops.push_back(loop);
+ ivs.push_back(loop.getInductionVar());
+ }
+ auto addr1 = builder.create<fir::CoordinateOp>(loc, refTy, value1, ivs);
+ auto addr2 = builder.create<fir::CoordinateOp>(loc, refTy, value2, ivs);
+ auto load1 = builder.create<fir::LoadOp>(loc, addr1);
+ auto load2 = builder.create<fir::LoadOp>(loc, addr2);
+ mlir::Value res =
+ genScalarCombiner(builder, loc, op, seqTy.getEleTy(), load1, load2);
+ builder.create<fir::StoreOp>(loc, res, addr1);
+ builder.setInsertionPointAfter(loops[0]);
+ } else {
+ mlir::Value res = genScalarCombiner(builder, loc, op, ty, value1, value2);
+ builder.create<fir::StoreOp>(loc, res, value1);
+ }
+}
+
mlir::acc::ReductionRecipeOp Fortran::lower::createOrGetReductionRecipe(
fir::FirOpBuilder &builder, llvm::StringRef recipeName, mlir::Location loc,
mlir::Type ty, mlir::acc::ReductionOperator op,
builder.createBlock(&recipe.getInitRegion(), recipe.getInitRegion().end(),
{ty}, {loc});
builder.setInsertionPointToEnd(&recipe.getInitRegion().back());
- mlir::Value initValue = genReductionInitValue(builder, loc, ty, op, bounds);
+ mlir::Value initValue = genReductionInitRegion(builder, loc, ty, op);
builder.create<mlir::acc::YieldOp>(loc, initValue);
builder.createBlock(&recipe.getCombinerRegion(),
builder.setInsertionPointToEnd(&recipe.getCombinerRegion().back());
mlir::Value v1 = recipe.getCombinerRegion().front().getArgument(0);
mlir::Value v2 = recipe.getCombinerRegion().front().getArgument(1);
- mlir::Value combinedValue = genCombiner(builder, loc, op, ty, v1, v2);
- builder.create<mlir::acc::YieldOp>(loc, combinedValue);
+ genCombiner(builder, loc, op, ty, v1, v2);
+ builder.create<mlir::acc::YieldOp>(loc, v1);
builder.restoreInsertionPoint(crtPos);
return recipe;
}
auto op = createDataEntryOp<mlir::acc::ReductionOp>(
builder, operandLocation, baseAddr, asFortran, bounds,
/*structured=*/true, mlir::acc::DataClause::acc_reduction, retTy);
- mlir::Type ty = fir::unwrapRefType(op.getAccPtr().getType());
- if (!fir::isa_trivial(ty))
- ty = retTy;
+ mlir::Type ty = op.getAccPtr().getType();
std::string recipeName = fir::getTypeAsString(
ty, converter.getKindMap(),
("reduction_" + stringifyReductionOperator(mlirOp)).str());
! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_10xi32 : !fir.ref<!fir.array<10xi32>> reduction_operator <add> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<10xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<0> : vector<10xi32>
-! CHECK: acc.yield %[[CST]] : vector<10xi32>
+! CHECK: %[[INIT:.*]] = arith.constant 0 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<10xi32>
+! CHECK: %[[LB:.*]] = arith.constant 0 : index
+! CHECK: %[[UB:.*]] = arith.constant 9 : index
+! CHECK: %[[STEP:.*]] = arith.constant 1 : index
+! CHECK: fir.do_loop %[[IV:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
+! CHECK: %[[COORD:.*]] = fir.coordinate_of %0, %[[IV]] : (!fir.ref<!fir.array<10xi32>>, index) -> !fir.ref<i32>
+! CHECK: fir.store %[[INIT]] to %[[COORD]] : !fir.ref<i32>
+! CHECK: }
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<10xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<10xi32>>):
! CHECK: %[[LB:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<10xi32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_mul_z32 : !fir.complex<4> reduction_operator <mul> init {
-! CHECK: ^bb0(%{{.*}}: !fir.complex<4>):
+! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_z32 : !fir.ref<!fir.complex<4>> reduction_operator <mul> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.complex<4>>):
! CHECK: %[[REAL:.*]] = arith.constant 1.000000e+00 : f32
! CHECK: %[[IMAG:.*]] = arith.constant 0.000000e+00 : f32
! CHECK: %[[UNDEF:.*]] = fir.undefined !fir.complex<4>
! CHECK: %[[UNDEF1:.*]] = fir.insert_value %[[UNDEF]], %[[REAL]], [0 : index] : (!fir.complex<4>, f32) -> !fir.complex<4>
! CHECK: %[[UNDEF2:.*]] = fir.insert_value %[[UNDEF1]], %[[IMAG]], [1 : index] : (!fir.complex<4>, f32) -> !fir.complex<4>
-! CHECK: acc.yield %[[UNDEF2]] : !fir.complex<4>
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.complex<4>
+! CHECK: fir.store %[[UNDEF2]] to %[[ALLOCA]] : !fir.ref<!fir.complex<4>>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.complex<4>>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: !fir.complex<4>, %[[ARG1:.*]]: !fir.complex<4>):
-! CHECK: %[[COMBINED:.*]] = fir.mulc %[[ARG0]], %[[ARG1]] : !fir.complex<4>
-! CHECK: acc.yield %[[COMBINED]] : !fir.complex<4>
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.complex<4>>, %[[ARG1:.*]]: !fir.ref<!fir.complex<4>>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.complex<4>>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<!fir.complex<4>>
+! CHECK: %[[COMBINED:.*]] = fir.mulc %[[LOAD0]], %[[LOAD1]] : !fir.complex<4>
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<!fir.complex<4>>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.complex<4>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_add_z32 : !fir.complex<4> reduction_operator <add> init {
-! CHECK: ^bb0(%{{.*}}: !fir.complex<4>):
+! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_z32 : !fir.ref<!fir.complex<4>> reduction_operator <add> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.complex<4>>):
! CHECK: %[[REAL:.*]] = arith.constant 0.000000e+00 : f32
! CHECK: %[[IMAG:.*]] = arith.constant 0.000000e+00 : f32
! CHECK: %[[UNDEF:.*]] = fir.undefined !fir.complex<4>
! CHECK: %[[UNDEF1:.*]] = fir.insert_value %[[UNDEF]], %[[REAL]], [0 : index] : (!fir.complex<4>, f32) -> !fir.complex<4>
! CHECK: %[[UNDEF2:.*]] = fir.insert_value %[[UNDEF1]], %[[IMAG]], [1 : index] : (!fir.complex<4>, f32) -> !fir.complex<4>
-! CHECK: acc.yield %[[UNDEF2]] : !fir.complex<4>
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.complex<4>
+! CHECK: fir.store %[[UNDEF2]] to %[[ALLOCA]] : !fir.ref<!fir.complex<4>>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.complex<4>>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: !fir.complex<4>, %[[ARG1:.*]]: !fir.complex<4>):
-! CHECK: %[[COMBINED:.*]] = fir.addc %[[ARG0]], %[[ARG1]] : !fir.complex<4>
-! CHECK: acc.yield %[[COMBINED]] : !fir.complex<4>
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.complex<4>>, %[[ARG1:.*]]: !fir.ref<!fir.complex<4>>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.complex<4>>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<!fir.complex<4>>
+! CHECK: %[[COMBINED:.*]] = fir.addc %[[LOAD0]], %[[LOAD1]] : !fir.complex<4>
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<!fir.complex<4>>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.complex<4>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_neqv_l32 : !fir.logical<4> reduction_operator <neqv> init {
-! CHECK: ^bb0(%{{.*}}: !fir.logical<4>):
+! CHECK-LABEL: acc.reduction.recipe @reduction_neqv_ref_l32 : !fir.ref<!fir.logical<4>> reduction_operator <neqv> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.logical<4>>):
! CHECK: %[[CST:.*]] = arith.constant false
-! CHECK: acc.yield %[[CST]] : i1
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.logical<4>
+! CHECK: %[[CONVERT:.*]] = fir.convert %[[CST]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CONVERT]] to %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: !fir.logical<4>, %[[ARG1:.*]]: !fir.logical<4>):
-! CHECK: %[[V1:.*]] = fir.convert %[[ARG0]] : (!fir.logical<4>) -> i1
-! CHECK: %[[V2:.*]] = fir.convert %[[ARG1]] : (!fir.logical<4>) -> i1
-! CHECK: %[[NEQV:.*]] = arith.cmpi ne, %[[V1]], %[[V2]] : i1
-! CHECK: %[[CONV:.*]] = fir.convert %[[NEQV]] : (i1) -> !fir.logical<4>
-! CHECK: acc.yield %[[CONV]] : !fir.logical<4>
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.logical<4>>, %[[ARG1:.*]]: !fir.ref<!fir.logical<4>>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[CONV0:.*]] = fir.convert %[[LOAD0]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CONV1:.*]] = fir.convert %[[LOAD1]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CMP:.*]] = arith.cmpi ne, %[[CONV0]], %[[CONV1]] : i1
+! CHECK: %[[CMP_CONV:.*]] = fir.convert %[[CMP]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CMP_CONV]] to %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.logical<4>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_eqv_l32 : !fir.logical<4> reduction_operator <eqv> init {
-! CHECK: ^bb0(%{{.*}}: !fir.logical<4>):
+! CHECK-LABEL: acc.reduction.recipe @reduction_eqv_ref_l32 : !fir.ref<!fir.logical<4>> reduction_operator <eqv> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.logical<4>>):
! CHECK: %[[CST:.*]] = arith.constant true
-! CHECK: acc.yield %[[CST]] : i1
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.logical<4>
+! CHECK: %[[CONVERT:.*]] = fir.convert %[[CST]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CONVERT]] to %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: !fir.logical<4>, %[[ARG1:.*]]: !fir.logical<4>):
-! CHECK: %[[V1:.*]] = fir.convert %[[ARG0]] : (!fir.logical<4>) -> i1
-! CHECK: %[[V2:.*]] = fir.convert %[[ARG1]] : (!fir.logical<4>) -> i1
-! CHECK: %[[EQV:.*]] = arith.cmpi eq, %[[V1]], %[[V2]] : i1
-! CHECK: %[[CONV:.*]] = fir.convert %[[EQV]] : (i1) -> !fir.logical<4>
-! CHECK: acc.yield %[[CONV]] : !fir.logical<4>
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.logical<4>>, %[[ARG1:.*]]: !fir.ref<!fir.logical<4>>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[CONV0:.*]] = fir.convert %[[LOAD0]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CONV1:.*]] = fir.convert %[[LOAD1]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CMP:.*]] = arith.cmpi eq, %[[CONV0]], %[[CONV1]] : i1
+! CHECK: %[[CMP_CONV:.*]] = fir.convert %[[CMP]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CMP_CONV]] to %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.logical<4>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_lor_l32 : !fir.logical<4> reduction_operator <lor> init {
-! CHECK: ^bb0(%{{.*}}: !fir.logical<4>):
+! CHECK-LABEL: acc.reduction.recipe @reduction_lor_ref_l32 : !fir.ref<!fir.logical<4>> reduction_operator <lor> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.logical<4>>):
! CHECK: %[[CST:.*]] = arith.constant false
-! CHECK: acc.yield %[[CST]] : i1
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.logical<4>
+! CHECK: %[[CONVERT:.*]] = fir.convert %[[CST]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CONVERT]] to %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: !fir.logical<4>, %[[ARG1:.*]]: !fir.logical<4>):
-! CHECK: %[[V1:.*]] = fir.convert %[[ARG0]] : (!fir.logical<4>) -> i1
-! CHECK: %[[V2:.*]] = fir.convert %[[ARG1]] : (!fir.logical<4>) -> i1
-! CHECK: %[[AND:.*]] = arith.ori %[[V1]], %[[V2]] : i1
-! CHECK: %[[CONV:.*]] = fir.convert %[[AND]] : (i1) -> !fir.logical<4>
-! CHECK: acc.yield %[[CONV]] : !fir.logical<4>
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.logical<4>>, %[[ARG1:.*]]: !fir.ref<!fir.logical<4>>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[CONV0:.*]] = fir.convert %[[LOAD0]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CONV1:.*]] = fir.convert %[[LOAD1]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CMP:.*]] = arith.ori %[[CONV0]], %[[CONV1]] : i1
+! CHECK: %[[CMP_CONV:.*]] = fir.convert %[[CMP]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CMP_CONV]] to %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.logical<4>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_land_l32 : !fir.logical<4> reduction_operator <land> init {
-! CHECK: ^bb0(%{{.*}}: !fir.logical<4>):
+! CHECK-LABEL: acc.reduction.recipe @reduction_land_ref_l32 : !fir.ref<!fir.logical<4>> reduction_operator <land> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.logical<4>>):
! CHECK: %[[CST:.*]] = arith.constant true
-! CHECK: acc.yield %[[CST]] : i1
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.logical<4>
+! CHECK: %[[CONVERT:.*]] = fir.convert %[[CST]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CONVERT]] to %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.logical<4>>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: !fir.logical<4>, %[[ARG1:.*]]: !fir.logical<4>):
-! CHECK: %[[V1:.*]] = fir.convert %[[ARG0]] : (!fir.logical<4>) -> i1
-! CHECK: %[[V2:.*]] = fir.convert %[[ARG1]] : (!fir.logical<4>) -> i1
-! CHECK: %[[AND:.*]] = arith.andi %[[V1]], %[[V2]] : i1
-! CHECK: %[[CONV:.*]] = fir.convert %[[AND]] : (i1) -> !fir.logical<4>
-! CHECK: acc.yield %[[CONV]] : !fir.logical<4>
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.logical<4>>, %[[ARG1:.*]]: !fir.ref<!fir.logical<4>>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<!fir.logical<4>>
+! CHECK: %[[CONV0:.*]] = fir.convert %[[LOAD0]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CONV1:.*]] = fir.convert %[[LOAD1]] : (!fir.logical<4>) -> i1
+! CHECK: %[[CMP:.*]] = arith.andi %[[CONV0]], %[[CONV1]] : i1
+! CHECK: %[[CMP_CONV:.*]] = fir.convert %[[CMP]] : (i1) -> !fir.logical<4>
+! CHECK: fir.store %[[CMP_CONV]] to %[[ARG0]] : !fir.ref<!fir.logical<4>>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.logical<4>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_xor_i32 : i32 reduction_operator <xor> init {
-! CHECK: ^bb0(%{{.*}}: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_xor_ref_i32 : !fir.ref<i32> reduction_operator <xor> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
! CHECK: %[[CST:.*]] = arith.constant 0 : i32
-! CHECK: acc.yield %[[CST]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[CST]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[COMBINED:.*]] = arith.xori %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[COMBINED]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[COMBINED:.*]] = arith.xori %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_ior_i32 : i32 reduction_operator <ior> init {
-! CHECK: ^bb0(%{{.*}}: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_ior_ref_i32 : !fir.ref<i32> reduction_operator <ior> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
! CHECK: %[[CST:.*]] = arith.constant 0 : i32
-! CHECK: acc.yield %[[CST]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[CST]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[COMBINED:.*]] = arith.ori %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[COMBINED]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[COMBINED:.*]] = arith.ori %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_iand_i32 : i32 reduction_operator <iand> init {
-! CHECK: ^bb0(%{{.*}}: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_iand_ref_i32 : !fir.ref<i32> reduction_operator <iand> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
! CHECK: %[[CST:.*]] = arith.constant -1 : i32
-! CHECK: acc.yield %[[CST]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[CST]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[COMBINED:.*]] = arith.andi %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[COMBINED]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[COMBINED:.*]] = arith.andi %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_100xf32 : !fir.ref<!fir.array<100xf32>> reduction_operator <max> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100xf32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<-1.401300e-45> : vector<100xf32>
-! CHECK: acc.yield %[[CST]] : vector<100xf32>
+! CHECK: %[[INIT:.*]] = arith.constant -1.401300e-45 : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100xf32>
+! CHECK: %[[LB:.*]] = arith.constant 0 : index
+! CHECK: %[[UB:.*]] = arith.constant 99 : index
+! CHECK: %[[STEP:.*]] = arith.constant 1 : index
+! CHECK: fir.do_loop %[[IV:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
+! CHECK: %[[COORD:.*]] = fir.coordinate_of %[[ALLOCA]], %[[IV]] : (!fir.ref<!fir.array<100xf32>>, index) -> !fir.ref<f32>
+! CHECK: fir.store %[[INIT]] to %[[COORD]] : !fir.ref<f32>
+! CHECK: }
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100xf32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>>):
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100xf32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_max_f32 : f32 reduction_operator <max> init {
-! CHECK: ^bb0(%{{.*}}: f32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_f32 : !fir.ref<f32> reduction_operator <max> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<f32>):
! CHECK: %[[INIT:.*]] = arith.constant -1.401300e-45 : f32
-! CHECK: acc.yield %[[INIT]] : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca f32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<f32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32):
-! CHECK: %[[CMP:.*]] = arith.cmpf ogt, %[[ARG0]], %[[ARG1]] : f32
-! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[ARG0]], %[[ARG1]] : f32
-! CHECK: acc.yield %[[SELECT]] : f32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<f32>, %[[ARG1:.*]]: !fir.ref<f32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<f32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<f32>
+! CHECK: %[[CMP:.*]] = arith.cmpf ogt, %[[LOAD0]], %[[LOAD1]] : f32
+! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[LOAD0]], %[[LOAD1]] : f32
+! CHECK: fir.store %[[SELECT]] to %[[ARG0]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<f32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_100x10xi32 : !fir.ref<!fir.array<100x10xi32>> reduction_operator <max> init {
! CHECK: ^bb0(%arg0: !fir.ref<!fir.array<100x10xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<-2147483648> : vector<100x10xi32>
-! CHECK: acc.yield %[[CST]] : vector<100x10xi32>
+! CHECK: %[[INIT:.*]] = arith.constant -2147483648 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100x10xi32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100x10xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>>):
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100x10xi32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_max_i32 : i32 reduction_operator <max> init {
-! CHECK: ^bb0(%arg0: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_max_ref_i32 : !fir.ref<i32> reduction_operator <max> init {
+! CHECK: ^bb0(%arg0: !fir.ref<i32>):
! CHECK: %[[INIT:.*]] = arith.constant -2147483648 : i32
-! CHECK: acc.yield %[[INIT]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[CMP:.*]] = arith.cmpi sgt, %[[ARG0]], %[[ARG1]] : i32
-! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[SELECT]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[CMP:.*]] = arith.cmpi sgt, %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[SELECT]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_100x10xf32 : !fir.ref<!fir.array<100x10xf32>> reduction_operator <min> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100x10xf32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<3.40282347E+38> : vector<100x10xf32>
-! CHECK: acc.yield %[[CST]] : vector<100x10xf32>
+! CHECK: %[[INIT:.*]] = arith.constant 3.40282347E+38 : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100x10xf32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100x10xf32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xf32>>):
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100x10xf32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_min_f32 : f32 reduction_operator <min> init {
-! CHECK: ^bb0(%{{.*}}: f32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_f32 : !fir.ref<f32> reduction_operator <min> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<f32>):
! CHECK: %[[INIT:.*]] = arith.constant 3.40282347E+38 : f32
-! CHECK: acc.yield %[[INIT]] : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca f32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<f32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32):
-! CHECK: %[[CMP:.*]] = arith.cmpf olt, %[[ARG0]], %[[ARG1]] : f32
-! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[ARG0]], %[[ARG1]] : f32
-! CHECK: acc.yield %[[SELECT]] : f32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<f32>, %[[ARG1:.*]]: !fir.ref<f32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<f32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<f32>
+! CHECK: %[[CMP:.*]] = arith.cmpf olt, %[[LOAD0]], %[[LOAD1]] : f32
+! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[LOAD0]], %[[LOAD1]] : f32
+! CHECK: fir.store %[[SELECT]] to %[[ARG0]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<f32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_100xi32 : !fir.ref<!fir.array<100xi32>> reduction_operator <min> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<2147483647> : vector<100xi32>
-! CHECK: acc.yield %[[CST]] : vector<100xi32>
+! CHECK: %[[INIT:.*]] = arith.constant 2147483647 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100xi32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>):
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100xi32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_min_i32 : i32 reduction_operator <min> init {
-! CHECK: ^bb0(%arg0: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_min_ref_i32 : !fir.ref<i32> reduction_operator <min> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
! CHECK: %[[INIT:.*]] = arith.constant 2147483647 : i32
-! CHECK: acc.yield %[[INIT]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[CMP:.*]] = arith.cmpi slt, %[[ARG0]], %[[ARG1]] : i32
-! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[SELECT]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[CMP:.*]] = arith.cmpi slt, %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: %[[SELECT:.*]] = arith.select %[[CMP]], %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[SELECT]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_mul_f32 : f32 reduction_operator <mul> init {
-! CHECK: ^bb0(%{{.*}}: f32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_f32 : !fir.ref<f32> reduction_operator <mul> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<f32>):
! CHECK: %[[INIT:.*]] = arith.constant 1.000000e+00 : f32
-! CHECK: acc.yield %[[INIT]] : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca f32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<f32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32):
-! CHECK: %[[COMBINED:.*]] = arith.mulf %[[ARG0]], %[[ARG1]] {{.*}} : f32
-! CHECK: acc.yield %[[COMBINED]] : f32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<f32>, %[[ARG1:.*]]: !fir.ref<f32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<f32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<f32>
+! CHECK: %[[COMBINED:.*]] = arith.mulf %[[LOAD0]], %[[LOAD1]] fastmath<contract> : f32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<f32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_100xi32 : !fir.ref<!fir.array<100xi32>> reduction_operator <mul> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<1> : vector<100xi32>
-! CHECK: acc.yield %[[CST]] : vector<100xi32>
+! CHECK: %[[INIT:.*]] = arith.constant 1 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100xi32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>):
! CHECK: %[[LB:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100xi32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_mul_i32 : i32 reduction_operator <mul> init {
-! CHECK: ^bb0(%{{.*}}: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_mul_ref_i32 : !fir.ref<i32> reduction_operator <mul> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
! CHECK: %[[INIT:.*]] = arith.constant 1 : i32
-! CHECK: acc.yield %[[INIT]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[COMBINED:.*]] = arith.muli %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[COMBINED]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[COMBINED:.*]] = arith.muli %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100xf32 : !fir.ref<!fir.array<100xf32>> reduction_operator <add> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100xf32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<0.000000e+00> : vector<100xf32>
-! CHECK: acc.yield %[[CST]] : vector<100xf32>
+! CHECK: %[[INIT:.*]] = arith.constant 0.000000e+00 : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100xf32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100xf32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xf32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xf32>>):
! CHECK: %[[LB:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100xf32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_add_f32 : f32 reduction_operator <add> init {
-! CHECK: ^bb0(%{{.*}}: f32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_f32 : !fir.ref<f32> reduction_operator <add> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<f32>):
! CHECK: %[[INIT:.*]] = arith.constant 0.000000e+00 : f32
-! CHECK: acc.yield %[[INIT]] : f32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca f32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<f32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32):
-! CHECK: %[[COMBINED:.*]] = arith.addf %[[ARG0]], %[[ARG1]] {{.*}} : f32
-! CHECK: acc.yield %[[COMBINED]] : f32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<f32>, %[[ARG1:.*]]: !fir.ref<f32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<f32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<f32>
+! CHECK: %[[COMBINED:.*]] = arith.addf %[[LOAD0]], %[[LOAD1]] fastmath<contract> : f32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<f32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<f32>
! CHECK: }
! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100x10x2xi32 : !fir.ref<!fir.array<100x10x2xi32>> reduction_operator <add> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100x10x2xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<0> : vector<100x10x2xi32>
-! CHECK: acc.yield %[[CST]] : vector<100x10x2xi32>
+! CHECK: %[[INIT:.*]] = arith.constant 0 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100x10x2xi32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100x10x2xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10x2xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10x2xi32>>):
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100x10xi32 : !fir.ref<!fir.array<100x10xi32>> reduction_operator <add> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100x10xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<0> : vector<100x10xi32>
-! CHECK: acc.yield %[[CST]] : vector<100x10xi32>
+! CHECK: %[[INIT:.*]] = arith.constant 0 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100x10xi32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100x10xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100x10xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100x10xi32>>):
! CHECK: %[[LB0:.*]] = arith.constant 0 : index
! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_100xi32 : !fir.ref<!fir.array<100xi32>> reduction_operator <add> init {
! CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100xi32>>):
-! CHECK: %[[CST:.*]] = arith.constant dense<0> : vector<100xi32>
-! CHECK: acc.yield %[[CST]] : vector<100xi32>
+! CHECK: %[[INIT:.*]] = arith.constant 0 : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.array<100xi32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<!fir.array<100xi32>>
! CHECK: } combiner {
! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<!fir.array<100xi32>>, %[[ARG1:.*]]: !fir.ref<!fir.array<100xi32>>):
! CHECK: %[[LB:.*]] = arith.constant 0 : index
! CHECK: acc.yield %[[ARG0]] : !fir.ref<!fir.array<100xi32>>
! CHECK: }
-! CHECK-LABEL: acc.reduction.recipe @reduction_add_i32 : i32 reduction_operator <add> init {
-! CHECK: ^bb0(%{{.*}}: i32):
+! CHECK-LABEL: acc.reduction.recipe @reduction_add_ref_i32 : !fir.ref<i32> reduction_operator <add> init {
+! CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
! CHECK: %[[INIT:.*]] = arith.constant 0 : i32
-! CHECK: acc.yield %[[INIT]] : i32
+! CHECK: %[[ALLOCA:.*]] = fir.alloca i32
+! CHECK: fir.store %[[INIT]] to %[[ALLOCA]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ALLOCA]] : !fir.ref<i32>
! CHECK: } combiner {
-! CHECK: ^bb0(%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32):
-! CHECK: %[[COMBINED:.*]] = arith.addi %[[ARG0]], %[[ARG1]] : i32
-! CHECK: acc.yield %[[COMBINED]] : i32
+! CHECK: ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):
+! CHECK: %[[LOAD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>
+! CHECK: %[[LOAD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>
+! CHECK: %[[COMBINED:.*]] = arith.addi %[[LOAD0]], %[[LOAD1]] : i32
+! CHECK: fir.store %[[COMBINED]] to %[[ARG0]] : !fir.ref<i32>
+! CHECK: acc.yield %[[ARG0]] : !fir.ref<i32>
! CHECK: }
subroutine acc_reduction_add_int(a, b)
! CHECK-LABEL: func.func @_QPacc_reduction_add_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop reduction(@reduction_add_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_add_int_array_1d(a, b)
integer :: a(100)
! CHECK-LABEL: func.func @_QPacc_reduction_add_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_add_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop reduction(@reduction_add_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_add_float_array_1d(a, b)
real :: a(100), b(100)
! CHECK-LABEL: func.func @_QPacc_reduction_mul_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_mul_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop reduction(@reduction_mul_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_mul_int_array_1d(a, b)
integer :: a(100)
! CHECK-LABEL: func.func @_QPacc_reduction_mul_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_mul_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop reduction(@reduction_mul_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_mul_float_array_1d(a, b)
real :: a(100), b(100)
! CHECK-LABEL: func.func @_QPacc_reduction_min_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_min_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop reduction(@reduction_min_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_min_int_array_1d(a, b)
integer :: a(100), b(100)
! CHECK-LABEL: func.func @_QPacc_reduction_min_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_min_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop reduction(@reduction_min_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_min_float_array2d(a, b)
real :: a(100, 10), b(100, 10)
! CHECK-LABEL: func.func @_QPacc_reduction_max_int(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xi32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<i32> {fir.bindc_name = "b"})
! CHECL: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<i32>) -> !fir.ref<i32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_max_i32 -> %[[RED_B]] : !fir.ref<i32>)
+! CHECK: acc.loop reduction(@reduction_max_ref_i32 -> %[[RED_B]] : !fir.ref<i32>)
subroutine acc_reduction_max_int_array2d(a, b)
integer :: a(100, 10), b(100, 10)
! CHECK-LABEL: func.func @_QPacc_reduction_max_float(
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.array<100xf32>> {fir.bindc_name = "a"}, %[[B:.*]]: !fir.ref<f32> {fir.bindc_name = "b"})
! CHECK: %[[RED_B:.*]] = acc.reduction varPtr(%[[B]] : !fir.ref<f32>) -> !fir.ref<f32> {name = "b"}
-! CHECK: acc.loop reduction(@reduction_max_f32 -> %[[RED_B]] : !fir.ref<f32>)
+! CHECK: acc.loop reduction(@reduction_max_ref_f32 -> %[[RED_B]] : !fir.ref<f32>)
subroutine acc_reduction_max_float_array1d(a, b)
real :: a(100), b(100)
! CHECK-LABEL: func.func @_QPacc_reduction_iand()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<i32>) -> !fir.ref<i32> {name = "i"}
-! CHECK: acc.parallel reduction(@reduction_iand_i32 -> %[[RED]] : !fir.ref<i32>)
+! CHECK: acc.parallel reduction(@reduction_iand_ref_i32 -> %[[RED]] : !fir.ref<i32>)
subroutine acc_reduction_ior()
integer :: i
! CHECK-LABEL: func.func @_QPacc_reduction_ior()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<i32>) -> !fir.ref<i32> {name = "i"}
-! CHECK: acc.parallel reduction(@reduction_ior_i32 -> %[[RED]] : !fir.ref<i32>)
+! CHECK: acc.parallel reduction(@reduction_ior_ref_i32 -> %[[RED]] : !fir.ref<i32>)
subroutine acc_reduction_ieor()
integer :: i
! CHECK-LABEL: func.func @_QPacc_reduction_ieor()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<i32>) -> !fir.ref<i32> {name = "i"}
-! CHECK: acc.parallel reduction(@reduction_xor_i32 -> %[[RED]] : !fir.ref<i32>)
+! CHECK: acc.parallel reduction(@reduction_xor_ref_i32 -> %[[RED]] : !fir.ref<i32>)
subroutine acc_reduction_and()
logical :: l
! CHECK-LABEL: func.func @_QPacc_reduction_and()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%0 : !fir.ref<!fir.logical<4>>) -> !fir.ref<!fir.logical<4>> {name = "l"}
-! CHECK: acc.parallel reduction(@reduction_land_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
+! CHECK: acc.parallel reduction(@reduction_land_ref_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
subroutine acc_reduction_or()
logical :: l
! CHECK-LABEL: func.func @_QPacc_reduction_or()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<!fir.logical<4>>) -> !fir.ref<!fir.logical<4>> {name = "l"}
-! CHECK: acc.parallel reduction(@reduction_lor_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
+! CHECK: acc.parallel reduction(@reduction_lor_ref_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
subroutine acc_reduction_eqv()
logical :: l
! CHECK-LABEL: func.func @_QPacc_reduction_eqv()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<!fir.logical<4>>) -> !fir.ref<!fir.logical<4>> {name = "l"}
-! CHECK: acc.parallel reduction(@reduction_eqv_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
+! CHECK: acc.parallel reduction(@reduction_eqv_ref_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
subroutine acc_reduction_neqv()
logical :: l
! CHECK-LABEL: func.func @_QPacc_reduction_neqv()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<!fir.logical<4>>) -> !fir.ref<!fir.logical<4>> {name = "l"}
-! CHECK: acc.parallel reduction(@reduction_neqv_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
+! CHECK: acc.parallel reduction(@reduction_neqv_ref_l32 -> %[[RED]] : !fir.ref<!fir.logical<4>>)
subroutine acc_reduction_add_cmplx()
complex :: c
! CHECK-LABEL: func.func @_QPacc_reduction_add_cmplx()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<!fir.complex<4>>) -> !fir.ref<!fir.complex<4>> {name = "c"}
-! CHECK: acc.parallel reduction(@reduction_add_z32 -> %[[RED]] : !fir.ref<!fir.complex<4>>)
+! CHECK: acc.parallel reduction(@reduction_add_ref_z32 -> %[[RED]] : !fir.ref<!fir.complex<4>>)
subroutine acc_reduction_mul_cmplx()
complex :: c
! CHECK-LABEL: func.func @_QPacc_reduction_mul_cmplx()
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%{{.*}} : !fir.ref<!fir.complex<4>>) -> !fir.ref<!fir.complex<4>> {name = "c"}
-! CHECK: acc.parallel reduction(@reduction_mul_z32 -> %[[RED]] : !fir.ref<!fir.complex<4>>)
+! CHECK: acc.parallel reduction(@reduction_mul_ref_z32 -> %[[RED]] : !fir.ref<!fir.complex<4>>)
subroutine acc_reduction_add_alloc()
integer, allocatable :: i
! CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA]] : !fir.ref<!fir.box<!fir.heap<i32>>>
! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[BOX_ADDR]] : !fir.heap<i32>) -> !fir.heap<i32> {name = "i"}
-! CHECK: acc.parallel reduction(@reduction_add_i32 -> %[[RED]] : !fir.heap<i32>)
+! CHECK: acc.parallel reduction(@reduction_add_heap_i32 -> %[[RED]] : !fir.heap<i32>)
subroutine acc_reduction_add_pointer(i)
integer, pointer :: i
! CHECK: %[[LOAD:.*]] = fir.load %[[ARG0]] : !fir.ref<!fir.box<!fir.ptr<i32>>>
! CHECK: %[[BOX_ADDR:.*]] = fir.box_addr %[[LOAD]] : (!fir.box<!fir.ptr<i32>>) -> !fir.ptr<i32>
! CHECK: %[[RED:.*]] = acc.reduction varPtr(%[[BOX_ADDR]] : !fir.ptr<i32>) -> !fir.ptr<i32> {name = "i"}
-! CHECK: acc.parallel reduction(@reduction_add_i32 -> %[[RED]] : !fir.ptr<i32>)
+! CHECK: acc.parallel reduction(@reduction_add_ptr_i32 -> %[[RED]] : !fir.ptr<i32>)
subroutine acc_reduction_add_static_slice(a)
integer :: a(100)