2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_intrinsic_ints.f90
blobfaa30788f44912b17ae3180e37fcf9dfe9abeb2b
1 ! { dg-do compile }
2 ! { dg-options "-fdec-intrinsic-ints" }
4 ! Test B/I/J/K integer intrinsics.
6 program main
8 implicit none
10 integer*1 :: ab = 9_1, bb = 3_1, cb
11 integer*2 :: ai = 9_2, bi = 3_2, ci
12 integer*4 :: aj = 9_4, bj = 3_4, cj
13 integer*8 :: ak = 9_8, bk = 3_8, ck
14 integer :: a = 9 , b = 3 , c
16 integer*1 :: ib = 9_1, bpos = 3_1
17 integer*2 :: ii = 9_2, ipos = 3_2
18 integer*4 :: ij = 9_4, jpos = 3_4
19 integer*8 :: ik = 9_8, kpos = 3_8
20 integer :: i = 9 , pos = 3
22 integer*1 :: ba, bc, bd
23 integer*2 :: ia, ic, id
24 integer*4 :: ja, jb, jc, jd
25 integer*8 :: ka, kb, kc, kd
27 logical*1 :: lb
28 logical*2 :: li
29 logical*4 :: lj
30 logical*8 :: lk
31 logical :: l
33 real :: r
35 lb = bbtest(ib, bpos)
36 li = bitest(ii, ipos)
37 lj = bjtest(ij, jpos)
38 lk = bktest(ik, kpos)
39 l = btest(i , pos)
41 lb = bbtest(9_1, 3_1)
42 li = bitest(9_2, 3_2)
43 lj = bjtest(9_4, 3_4)
44 lk = bktest(9_8, 3_8)
45 l = btest(9 , 3 )
47 r = floati(ai)
48 r = floatj(aj)
49 r = floatk(ak)
50 r = float (a )
52 r = floati(9_2)
53 r = floatj(9_4)
54 r = floatk(9_8)
55 r = float (9 )
57 bb = babs(ab)
58 bi = iiabs(ai)
59 bj = jiabs(aj)
60 bk = kiabs(ak)
61 b = iabs(a )
63 bb = babs(9_1)
64 bi = iiabs(9_2)
65 bj = jiabs(9_4)
66 bk = kiabs(9_8)
67 b = iabs(9 )
69 cb = biand(ab, bb)
70 ci = iiand(ai, bi)
71 cj = jiand(aj, bj)
72 ck = kiand(ak, bk)
73 c = iand(a , b )
75 cb = biand(9_1, 3_1)
76 ci = iiand(9_2, 3_2)
77 cj = jiand(9_4, 3_4)
78 ck = kiand(9_8, 3_8)
79 c = iand(9 , 3 )
81 cb = bbclr(ib, bpos)
82 ci = iibclr(ii, ipos)
83 cj = jibclr(ij, jpos)
84 ck = kibclr(ik, kpos)
85 c = ibclr(i , pos)
87 cb = bbclr(9_1, 3_1)
88 ci = iibclr(9_2, 3_2)
89 cj = jibclr(9_4, 3_4)
90 ck = kibclr(9_8, 3_8)
91 c = ibclr(i , pos)
93 cb = bbset(ib, bpos)
94 ci = iibset(ii, ipos)
95 cj = jibset(ij, jpos)
96 ck = kibset(ik, kpos)
97 c = ibset(i , pos)
99 cb = bbset(9_1, 3_1)
100 ci = iibset(9_2, 3_2)
101 cj = jibset(9_4, 3_4)
102 ck = kibset(9_8, 3_8)
103 c = ibset(i , pos)
105 cb = bieor(ab, bb)
106 ci = iieor(ai, bi)
107 cj = jieor(aj, bj)
108 ck = kieor(ak, bk)
109 c = ieor(a , b )
111 cb = bieor(9_1, 3_1)
112 ci = iieor(9_2, 3_2)
113 cj = jieor(9_4, 3_4)
114 ck = kieor(9_8, 3_8)
115 c = ieor(9 , 3 )
117 cb = bior(ab, bb)
118 ci = iior(ai, bi)
119 cj = jior(aj, bj)
120 ck = kior(ak, bk)
121 c = ior(a , b )
123 cb = bior(9_1, 3_1)
124 ci = iior(9_2, 3_2)
125 cj = jior(9_4, 3_4)
126 ck = kior(9_8, 3_8)
127 c = ior(9 , 3 )
129 cb = bmod(ab, bb)
130 ci = imod(ai, bi)
131 cj = jmod(aj, bj)
132 ck = kmod(ak, bk)
133 c = mod(a , b )
135 cb = bmod(9_1, 3_1)
136 ci = imod(9_2, 3_2)
137 cj = jmod(9_4, 3_4)
138 ck = kmod(9_8, 3_8)
139 c = mod(9 , 3 )
141 ba = bbits(121, 10, 5)
142 call bmvbits(121_1, 2, 3, ba, 1)
143 bc = bshftc(ba, 3, 6)
144 bd = bshft(bc, -3)
145 ba = bnot(bd)
147 ia = iibits(357, 10, 5)
148 call imvbits(357_2, 8, 3, ia, 1)
149 ic = iishftc(ia, 3, 6)
150 id = iishft(ic, -3)
151 ia = inot(id)
153 ja = jibits(357, 10, 5)
154 call jmvbits(357_4, 8, 3, ja, 1)
155 jc = jishftc(ja, 3, 6)
156 jd = jishft(jc, -3)
157 ja = jnot(jd)
159 ka = kibits(357_8, 10_8, 5_8)
160 call kmvbits(357_8, 8_8, 3_8, ka, 1_8)
161 kc = kishftc(ka, 3_8, 6_8)
162 kd = kishft(kc, -3_8)
163 ka = knot(kd)
165 end program