diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/libgomp/testsuite/libgomp.fortran/lib2.f | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/libgomp/testsuite/libgomp.fortran/lib2.f')
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.fortran/lib2.f | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.fortran/lib2.f b/gcc-4.9/libgomp/testsuite/libgomp.fortran/lib2.f new file mode 100644 index 000000000..20db04a1c --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.fortran/lib2.f @@ -0,0 +1,77 @@ +C { dg-do run } + + USE OMP_LIB + + DOUBLE PRECISION :: D, E + LOGICAL :: L + INTEGER (KIND = OMP_LOCK_KIND) :: LCK + INTEGER (KIND = OMP_NEST_LOCK_KIND) :: NLCK + + D = OMP_GET_WTIME () + + CALL OMP_INIT_LOCK (LCK) + CALL OMP_SET_LOCK (LCK) + IF (OMP_TEST_LOCK (LCK)) CALL ABORT + CALL OMP_UNSET_LOCK (LCK) + IF (.NOT. OMP_TEST_LOCK (LCK)) CALL ABORT + IF (OMP_TEST_LOCK (LCK)) CALL ABORT + CALL OMP_UNSET_LOCK (LCK) + CALL OMP_DESTROY_LOCK (LCK) + + CALL OMP_INIT_NEST_LOCK (NLCK) + IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 1) CALL ABORT + CALL OMP_SET_NEST_LOCK (NLCK) + IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 3) CALL ABORT + CALL OMP_UNSET_NEST_LOCK (NLCK) + CALL OMP_UNSET_NEST_LOCK (NLCK) + IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 2) CALL ABORT + CALL OMP_UNSET_NEST_LOCK (NLCK) + CALL OMP_UNSET_NEST_LOCK (NLCK) + CALL OMP_DESTROY_NEST_LOCK (NLCK) + + CALL OMP_SET_DYNAMIC (.TRUE.) + IF (.NOT. OMP_GET_DYNAMIC ()) CALL ABORT + CALL OMP_SET_DYNAMIC (.FALSE.) + IF (OMP_GET_DYNAMIC ()) CALL ABORT + + CALL OMP_SET_NESTED (.TRUE.) + IF (.NOT. OMP_GET_NESTED ()) CALL ABORT + CALL OMP_SET_NESTED (.FALSE.) + IF (OMP_GET_NESTED ()) CALL ABORT + + CALL OMP_SET_NUM_THREADS (5) + IF (OMP_GET_NUM_THREADS () .NE. 1) CALL ABORT + IF (OMP_GET_MAX_THREADS () .NE. 5) CALL ABORT + IF (OMP_GET_THREAD_NUM () .NE. 0) CALL ABORT + CALL OMP_SET_NUM_THREADS (3) + IF (OMP_GET_NUM_THREADS () .NE. 1) CALL ABORT + IF (OMP_GET_MAX_THREADS () .NE. 3) CALL ABORT + IF (OMP_GET_THREAD_NUM () .NE. 0) CALL ABORT + L = .FALSE. +C$OMP PARALLEL REDUCTION (.OR.:L) + L = OMP_GET_NUM_THREADS () .NE. 3 + L = L .OR. (OMP_GET_THREAD_NUM () .LT. 0) + L = L .OR. (OMP_GET_THREAD_NUM () .GE. 3) +C$OMP MASTER + L = L .OR. (OMP_GET_THREAD_NUM () .NE. 0) +C$OMP END MASTER +C$OMP END PARALLEL + IF (L) CALL ABORT + + IF (OMP_GET_NUM_PROCS () .LE. 0) CALL ABORT + IF (OMP_IN_PARALLEL ()) CALL ABORT +C$OMP PARALLEL REDUCTION (.OR.:L) + L = .NOT. OMP_IN_PARALLEL () +C$OMP END PARALLEL +C$OMP PARALLEL REDUCTION (.OR.:L) IF (.TRUE.) + L = .NOT. OMP_IN_PARALLEL () +C$OMP END PARALLEL + IF (L) CALL ABORT + + E = OMP_GET_WTIME () + IF (D .GT. E) CALL ABORT + D = OMP_GET_WTICK () +C Negative precision is definitely wrong, +C bigger than 1s clock resolution is also strange + IF (D .LE. 0 .OR. D .GT. 1.) CALL ABORT + END |