1 ! Test the MASKL and MASKR intrinsics.
4 ! { dg-options "-ffree-line-length-none" }
5 ! { dg-require-effective-target fortran_integer_16 }
7 #define CHECK(I,KIND,FUNCL,FUNCR,RESL,RESR) \
8 if (maskl(I,KIND) /= RESL) call abort ; \
9 if (FUNCL(I) /= RESL) call abort ; \
10 if (maskr(I,KIND) /= RESR) call abort ; \
11 if (FUNCR(I) /= RESR) call abort
13 CHECK(0,16,run_maskl16,run_maskr16,0_16,0_16)
14 CHECK(1,16,run_maskl16,run_maskr16,-huge(0_16)-1_16,1_16)
15 CHECK(2,16,run_maskl16,run_maskr16,(-huge(0_16)-1_16)/2_16,3_16)
16 CHECK(3,16,run_maskl16,run_maskr16,(-huge(0_16)-1_16)/4_16,7_16)
17 CHECK(int(bit_size(0_16))-2,16,run_maskl16,run_maskr16,-4_16,huge(0_16)/2_16)
18 CHECK(int(bit_size(0_16))-1,16,run_maskl16,run_maskr16,-2_16,huge(0_16))
19 CHECK(int(bit_size(0_16)),16,run_maskl16,run_maskr16,-1_16,-1_16)
23 pure integer(kind=16) function run_maskl16(i) result(res)
24 integer, intent(in) :: i
25 res = maskl(i,kind=16)
27 pure integer(kind=16) function run_maskr16(i) result(res)
28 integer, intent(in) :: i
29 res = maskr(i,kind=16)