This is an archive of the discontinued LLVM Phabricator instance.

{Flang][OpenMP] Add support for ior, ieor, and iand reduction in worksharing-loop
ClosedPublic

Authored by do on Apr 22 2023, 7:39 AM.

Details

Diff Detail

Event Timeline

do created this revision.Apr 22 2023, 7:39 AM
do requested review of this revision.Apr 22 2023, 7:39 AM
do updated this revision to Diff 516076.Apr 22 2023, 8:21 AM
do updated this revision to Diff 516078.Apr 22 2023, 8:38 AM

LG. Please see minor comments inline.

flang/lib/Lower/OpenMP.cpp
1184–1188

Nit: The code for ior and ieor is the same and can be shared. Like the following.

} else if (reductionOpName.contains("ior") || reductionOpName.contains("ieor")) {
  unsigned bits = type.getIntOrFloatBitWidth();
  int64_t zeroInt = llvm::APInt::getZero(bits).getSExtValue();
  return builder.createIntegerConstant(loc, type, zeroInt);
}
2423

Nit: Remove empty line.

flang/test/Lower/OpenMP/wsloop-reduction-iand.f90
30

Nit: Can you add another test with x = iand(y(i), x)

flang/test/Lower/OpenMP/wsloop-reduction-ieor.f90
30

Nit: Can you add another test with x = ieor(y(i), x)

flang/test/Lower/OpenMP/wsloop-reduction-ior.f90
30

Nit: Can you add another test with x = ior(y(i), x)

This revision is now accepted and ready to land.Apr 24 2023, 7:50 AM
flang/test/Lower/OpenMP/Todo/reduction-iand.f90