modula2: Simplify REAL/LONGREAL/SHORTREAL node creation.
[official-gcc.git] / gcc / testsuite / gfortran.dg / bit_comparison_2.F90
blob71513ed2dccbb8d67c9ec7f05e02f66a04a408d7
1 ! Test the BGE, BGT, BLE and BLT intrinsics.
3 ! { dg-do run }
4 ! { dg-options "-ffree-line-length-none" }
5 ! { dg-require-effective-target fortran_integer_16 }
7 #define CHECK(I,J,RES) \
8   if (bge(I,J) .neqv. RES) STOP 1; \
9   if (run_bge(I,J) .neqv. RES) STOP 2; \
10   if (bgt(I,J) .neqv. (RES .and. (I/=J))) STOP 3; \
11   if (run_bgt(I,J) .neqv. (RES .and. (I/=J))) STOP 4; \
12   if (ble(J,I) .neqv. RES) STOP 5; \
13   if (run_ble(J,I) .neqv. RES) STOP 6; \
14   if (blt(J,I) .neqv. (RES .and. (I/=J))) STOP 7; \
15   if (run_blt(J,I) .neqv. (RES .and. (I/=J))) STOP 8
17 #define T .true.
18 #define F .false.
20   CHECK(0_16, 0_16, T)
21   CHECK(1_16, 0_16, T)
22   CHECK(0_16, 107_16, F)
23   CHECK(5_16, huge(0_16) / 2_16, F)
24   CHECK(5_16, huge(0_16), F)
25   CHECK(-1_16, 0_16, T)
26   CHECK(0_16, -19_16, F)
27   CHECK(huge(0_16), -19_16, F)
29 contains
31   pure logical function run_bge (i, j) result(res)
32     integer(kind=16), intent(in) :: i, j
33     res = bge(i,j)
34   end function
35   pure logical function run_bgt (i, j) result(res)
36     integer(kind=16), intent(in) :: i, j
37     res = bgt(i,j)
38   end function
39   pure logical function run_ble (i, j) result(res)
40     integer(kind=16), intent(in) :: i, j
41     res = ble(i,j)
42   end function
43   pure logical function run_blt (i, j) result(res)
44     integer(kind=16), intent(in) :: i, j
45     res = blt(i,j)
46   end function
48 end