1 ! Test the SHIFTA, SHIFTL and SHIFTR intrinsics.
4 ! { dg-options "-ffree-line-length-none" }
5 ! { dg-require-effective-target fortran_integer_16 }
9 #define CHECK(I,SHIFT,RESA,RESL,RESR) \
10 if (shifta(I,SHIFT) /= RESA) call abort ; \
11 if (shiftr(I,SHIFT) /= RESR) call abort ; \
12 if (shiftl(I,SHIFT) /= RESL) call abort ; \
13 if (run_shifta(I,SHIFT) /= RESA) call abort ; \
14 if (run_shiftr(I,SHIFT) /= RESR) call abort ; \
15 if (run_shiftl(I,SHIFT) /= RESL) call abort ; \
16 if (ishft(I,SHIFT) /= RESL) call abort ; \
17 if (ishft(I,-SHIFT) /= RESR) call abort ; \
18 if (run_ishft(I,SHIFT) /= RESL) call abort ; \
19 if (run_ishft(I,-SHIFT) /= RESR) call abort
21 CHECK(0_16,0,0_16,0_16,0_16)
22 CHECK(11_16,0,11_16,11_16,11_16)
23 CHECK(-11_16,0,-11_16,-11_16,-11_16)
24 CHECK(0_16,1,0_16,0_16,0_16)
25 CHECK(11_16,1,5_16,22_16,5_16)
26 CHECK(11_16,2,2_16,44_16,2_16)
27 CHECK(-11_16,1,-6_16,-22_16,huge(0_16)-5_16)
31 function run_shifta (i, shift) result(res)
32 integer(kind=16) :: i, res
36 function run_shiftl (i, shift) result(res)
37 integer(kind=16) :: i, res
41 function run_shiftr (i, shift) result(res)
42 integer(kind=16) :: i, res
46 function run_ishft (i, shift) result(res)
47 integer(kind=16) :: i, res