brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · fc977f2 Raw
52 lines · plain
1! RUN: %flang_fc1 -fdebug-dump-symbols -fopenmp -fopenmp-version=50 %s | FileCheck %s2 3!! Test that the name mangling for min & max (also used for iand, ieor and ior).4module mymod5  type :: tt6     real r7  end type tt8contains9  function mymax(a, b)10    type(tt) :: a, b, mymax11    if (a%r > b%r) then12       mymax = a13    else14       mymax = b15    end if16  end function mymax17end module mymod18 19program omp_examples20!CHECK-LABEL: MainProgram scope: OMP_EXAMPLES21  use mymod22  implicit none23  integer, parameter :: n = 10024  integer :: i25  type(tt) :: values(n), big, small26 27  !$omp declare reduction(max:tt:omp_out = mymax(omp_out, omp_in)) initializer(omp_priv%r = 0)28  !$omp declare reduction(min:tt:omp_out%r = min(omp_out%r, omp_in%r)) initializer(omp_priv%r = 1)29 30!CHECK: min, ELEMENTAL, INTRINSIC, PURE (Function): ProcEntity31!CHECK: mymax (Function): Use from mymax in mymod32!CHECK: op.max: UserReductionDetails TYPE(tt)33!CHECK: op.min: UserReductionDetails TYPE(tt)34 35  big%r = 036  !$omp parallel do reduction(max:big)37!CHECK: big (OmpReduction, OmpExplicit): HostAssoc38!CHECK: max, INTRINSIC: ProcEntity  39  do i = 1, n40     big = mymax(values(i), big)41  end do42 43  small%r = 144  !$omp parallel do reduction(min:small)45!CHECK: small (OmpReduction, OmpExplicit): HostAssoc46  do i = 1, n47     small%r = min(values(i)%r, small%r)48  end do49  50  print *, "small=", small%r, " big=", big%r51end program omp_examples52