1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
! Test the DSHIFTL and DSHIFTR intrinsics.
!
! { dg-do run }
! { dg-options "-ffree-line-length-none" }
implicit none
interface run_dshiftl
procedure dshiftl_1
procedure dshiftl_2
procedure dshiftl_4
procedure dshiftl_8
end interface
interface run_dshiftr
procedure dshiftr_1
procedure dshiftr_2
procedure dshiftr_4
procedure dshiftr_8
end interface
#define RESL(I,J,SHIFT) \
IOR(SHIFTL(I,SHIFT),SHIFTR(J,BIT_SIZE(J)-SHIFT))
#define RESR(I,J,SHIFT) \
IOR(SHIFTL(I,BIT_SIZE(I)-SHIFT),SHIFTR(J,SHIFT))
#define CHECK(I,J,SHIFT) \
if (dshiftl(I,J,SHIFT) /= RESL(I,J,SHIFT)) call abort ; \
if (dshiftr(I,J,SHIFT) /= RESR(I,J,SHIFT)) call abort ; \
if (run_dshiftl(I,J,SHIFT) /= RESL(I,J,SHIFT)) call abort ; \
if (run_dshiftr(I,J,SHIFT) /= RESR(I,J,SHIFT)) call abort
CHECK(0_1,0_1,0)
CHECK(0_1,0_1,1)
CHECK(0_1,0_1,7)
CHECK(0_1,0_1,8)
CHECK(28_1,79_1,0)
CHECK(28_1,79_1,1)
CHECK(28_1,79_1,5)
CHECK(28_1,79_1,7)
CHECK(28_1,79_1,8)
CHECK(-28_1,79_1,0)
CHECK(-28_1,79_1,1)
CHECK(-28_1,79_1,5)
CHECK(-28_1,79_1,7)
CHECK(-28_1,79_1,8)
CHECK(28_1,-79_1,0)
CHECK(28_1,-79_1,1)
CHECK(28_1,-79_1,5)
CHECK(28_1,-79_1,7)
CHECK(28_1,-79_1,8)
CHECK(-28_1,-79_1,0)
CHECK(-28_1,-79_1,1)
CHECK(-28_1,-79_1,5)
CHECK(-28_1,-79_1,7)
CHECK(-28_1,-79_1,8)
CHECK(0_2,0_2,0)
CHECK(0_2,0_2,1)
CHECK(0_2,0_2,7)
CHECK(0_2,0_2,8)
CHECK(28_2,79_2,0)
CHECK(28_2,79_2,1)
CHECK(28_2,79_2,5)
CHECK(28_2,79_2,7)
CHECK(28_2,79_2,8)
CHECK(-28_2,79_2,0)
CHECK(-28_2,79_2,1)
CHECK(-28_2,79_2,5)
CHECK(-28_2,79_2,7)
CHECK(-28_2,79_2,8)
CHECK(28_2,-79_2,0)
CHECK(28_2,-79_2,1)
CHECK(28_2,-79_2,5)
CHECK(28_2,-79_2,7)
CHECK(28_2,-79_2,8)
CHECK(-28_2,-79_2,0)
CHECK(-28_2,-79_2,1)
CHECK(-28_2,-79_2,5)
CHECK(-28_2,-79_2,7)
CHECK(-28_2,-79_2,8)
CHECK(0_4,0_4,0)
CHECK(0_4,0_4,1)
CHECK(0_4,0_4,7)
CHECK(0_4,0_4,8)
CHECK(28_4,79_4,0)
CHECK(28_4,79_4,1)
CHECK(28_4,79_4,5)
CHECK(28_4,79_4,7)
CHECK(28_4,79_4,8)
CHECK(-28_4,79_4,0)
CHECK(-28_4,79_4,1)
CHECK(-28_4,79_4,5)
CHECK(-28_4,79_4,7)
CHECK(-28_4,79_4,8)
CHECK(28_4,-79_4,0)
CHECK(28_4,-79_4,1)
CHECK(28_4,-79_4,5)
CHECK(28_4,-79_4,7)
CHECK(28_4,-79_4,8)
CHECK(-28_4,-79_4,0)
CHECK(-28_4,-79_4,1)
CHECK(-28_4,-79_4,5)
CHECK(-28_4,-79_4,7)
CHECK(-28_4,-79_4,8)
CHECK(0_8,0_8,0)
CHECK(0_8,0_8,1)
CHECK(0_8,0_8,7)
CHECK(0_8,0_8,8)
CHECK(28_8,79_8,0)
CHECK(28_8,79_8,1)
CHECK(28_8,79_8,5)
CHECK(28_8,79_8,7)
CHECK(28_8,79_8,8)
CHECK(-28_8,79_8,0)
CHECK(-28_8,79_8,1)
CHECK(-28_8,79_8,5)
CHECK(-28_8,79_8,7)
CHECK(-28_8,79_8,8)
CHECK(28_8,-79_8,0)
CHECK(28_8,-79_8,1)
CHECK(28_8,-79_8,5)
CHECK(28_8,-79_8,7)
CHECK(28_8,-79_8,8)
CHECK(-28_8,-79_8,0)
CHECK(-28_8,-79_8,1)
CHECK(-28_8,-79_8,5)
CHECK(-28_8,-79_8,7)
CHECK(-28_8,-79_8,8)
contains
function dshiftl_1 (i, j, shift) result(res)
integer(kind=1) :: i, j, res
integer :: shift
res = dshiftl(i,j,shift)
end function
function dshiftl_2 (i, j, shift) result(res)
integer(kind=2) :: i, j, res
integer :: shift
res = dshiftl(i,j,shift)
end function
function dshiftl_4 (i, j, shift) result(res)
integer(kind=4) :: i, j, res
integer :: shift
res = dshiftl(i,j,shift)
end function
function dshiftl_8 (i, j, shift) result(res)
integer(kind=8) :: i, j, res
integer :: shift
res = dshiftl(i,j,shift)
end function
function dshiftr_1 (i, j, shift) result(res)
integer(kind=1) :: i, j, res
integer :: shift
res = dshiftr(i,j,shift)
end function
function dshiftr_2 (i, j, shift) result(res)
integer(kind=2) :: i, j, res
integer :: shift
res = dshiftr(i,j,shift)
end function
function dshiftr_4 (i, j, shift) result(res)
integer(kind=4) :: i, j, res
integer :: shift
res = dshiftr(i,j,shift)
end function
function dshiftr_8 (i, j, shift) result(res)
integer(kind=8) :: i, j, res
integer :: shift
res = dshiftr(i,j,shift)
end function
end
|