bool addWaitAttr = false;
bool addSelfAttr = false;
+ bool hasDefaultNone = false;
+ bool hasDefaultPresent = false;
+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
// Lower clauses values mapped to operands.
&clause.u)) {
genReductions(reductionClause->v, converter, semanticsContext, stmtCtx,
reductionOperands, reductionRecipes);
+ } else if (const auto *defaultClause =
+ std::get_if<Fortran::parser::AccClause::Default>(
+ &clause.u)) {
+ if ((defaultClause->v).v == llvm::acc::DefaultValue::ACC_Default_none)
+ hasDefaultNone = true;
+ else if ((defaultClause->v).v ==
+ llvm::acc::DefaultValue::ACC_Default_present)
+ hasDefaultPresent = true;
}
}
if (addSelfAttr)
computeOp.setSelfAttrAttr(builder.getUnitAttr());
+ if (hasDefaultNone)
+ computeOp.setDefaultAttr(mlir::acc::ClauseDefaultValue::None);
+ if (hasDefaultPresent)
+ computeOp.setDefaultAttr(mlir::acc::ClauseDefaultValue::Present);
+
if constexpr (!std::is_same_v<Op, mlir::acc::KernelsOp>) {
if (!privatizations.empty())
computeOp.setPrivatizationsAttr(
! CHECK: acc.terminator
! CHECK-NEXT: }{{$}}
+!$acc kernels default(none)
+!$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: } attributes {defaultAttr = #acc<defaultvalue none>}
+
+!$acc kernels default(present)
+!$acc end kernels
+
+! CHECK: acc.kernels {
+! CHECK: } attributes {defaultAttr = #acc<defaultvalue present>}
+
end subroutine acc_kernels
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
+!$acc parallel default(none)
+!$acc end parallel
+
+! CHECK: acc.parallel {
+! CHECK: } attributes {defaultAttr = #acc<defaultvalue none>}
+
+!$acc parallel default(present)
+!$acc end parallel
+
+! CHECK: acc.parallel {
+! CHECK: } attributes {defaultAttr = #acc<defaultvalue present>}
+
end subroutine acc_parallel
! CHECK: acc.yield
! CHECK-NEXT: }{{$}}
+!$acc serial default(none)
+!$acc end serial
+
+! CHECK: acc.serial {
+! CHECK: } attributes {defaultAttr = #acc<defaultvalue none>}
+
+!$acc serial default(present)
+!$acc end serial
+
+! CHECK: acc.serial {
+! CHECK: } attributes {defaultAttr = #acc<defaultvalue present>}
+
end subroutine