Debian Codegraph @

gcc/testsuite/gfortran.dg/unsigned_9.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-funsigned" }
3 ! Test dshiftl, dshiftr, ibclr, ibset and ibits intrinsics.
4 program main
5 unsigned :: u, v, w
6 integer :: i, j, k
7
8 u = 1u; v = 4u
9 i = 1; j = 4
10 if (int(dshiftl(u,v,12)) /= dshiftl(i,j,12)) error stop 1
11 if (int(dshiftl(1u,4u,12)) /= dshiftl(1,4,12)) error stop 2
12 if (int(dshiftr(u,v,12)) /= dshiftr(i,j,12)) error stop 3
13 if (int(dshiftr(1u,4u,12)) /= dshiftr(1,4,12)) error stop 4
14
15 k = 14
16
17 if (int(dshiftl(u,v,k)) /= dshiftl(i,j,k)) error stop 5
18 if (int(dshiftl(1u,4u,k)) /= dshiftl(1,4,k)) error stop 6
19 if (int(dshiftr(u,v,k)) /= dshiftr(i,j,k)) error stop 7
20 if (int(dshiftr(1u,4u,k)) /= dshiftr(1,4,k)) error stop 8
21
22 u = 255u
23 i = 255
24 do k=0,8
25 if (ibclr(i,k) /= int(ibclr(u,k))) error stop 9
26 if (ibset(i,k+4) /= int(ibset(u,k+4))) error stop 10
27 end do
28 if (ibclr(255,5) /= int(ibclr(255u,5))) error stop 11
29 if (ibset(255,10) /= int(ibset(255u,10))) error stop 12
30
31 if (uint(ibits(6,6,2)) /= ibits(6u,6,2)) error stop 13
32 end program main