[AArch64] SVE tests
[official-gcc.git] / gcc / testsuite / gfortran.dg / minlocval_1.f90
blobc877f1e823a9f645ecef9c29205791b1612d79eb
1 ! { dg-do run }
2 ! { dg-add-options ieee }
3 ! { dg-skip-if "NaN not supported" { spu-*-* } }
4 real :: a(3), nan, minf, pinf
5 real, allocatable :: c(:)
6 logical :: l
7 logical :: l2(3)
9 nan = 0.0
10 minf = 0.0
11 pinf = 0.0
12 nan = 0.0/nan
13 minf = -1.0/minf
14 pinf = 1.0/pinf
16 allocate (c(3))
17 a(:) = nan
18 if (minloc (a, dim = 1).ne.1) call abort
19 if (.not.isnan(minval (a, dim = 1))) call abort
20 a(:) = pinf
21 if (minloc (a, dim = 1).ne.1) call abort
22 if (minval (a, dim = 1).ne.pinf) call abort
23 a(1:2) = nan
24 if (minloc (a, dim = 1).ne.3) call abort
25 if (minval (a, dim = 1).ne.pinf) call abort
26 a(2) = 1.0
27 if (minloc (a, dim = 1).ne.2) call abort
28 if (minval (a, dim = 1).ne.1) call abort
29 a(2) = minf
30 if (minloc (a, dim = 1).ne.2) call abort
31 if (minval (a, dim = 1).ne.minf) call abort
32 c(:) = nan
33 if (minloc (c, dim = 1).ne.1) call abort
34 if (.not.isnan(minval (c, dim = 1))) call abort
35 c(:) = pinf
36 if (minloc (c, dim = 1).ne.1) call abort
37 if (minval (c, dim = 1).ne.pinf) call abort
38 c(1:2) = nan
39 if (minloc (c, dim = 1).ne.3) call abort
40 if (minval (c, dim = 1).ne.pinf) call abort
41 c(2) = 1.0
42 if (minloc (c, dim = 1).ne.2) call abort
43 if (minval (c, dim = 1).ne.1) call abort
44 c(2) = minf
45 if (minloc (c, dim = 1).ne.2) call abort
46 if (minval (c, dim = 1).ne.minf) call abort
47 l = .false.
48 l2(:) = .false.
49 a(:) = nan
50 if (minloc (a, dim = 1, mask = l).ne.0) call abort
51 if (minval (a, dim = 1, mask = l).ne.huge(pinf)) call abort
52 if (minloc (a, dim = 1, mask = l2).ne.0) call abort
53 if (minval (a, dim = 1, mask = l2).ne.huge(pinf)) call abort
54 a(:) = pinf
55 if (minloc (a, dim = 1, mask = l).ne.0) call abort
56 if (minval (a, dim = 1, mask = l).ne.huge(pinf)) call abort
57 if (minloc (a, dim = 1, mask = l2).ne.0) call abort
58 if (minval (a, dim = 1, mask = l2).ne.huge(pinf)) call abort
59 a(1:2) = nan
60 if (minloc (a, dim = 1, mask = l).ne.0) call abort
61 if (minval (a, dim = 1, mask = l).ne.huge(pinf)) call abort
62 if (minloc (a, dim = 1, mask = l2).ne.0) call abort
63 if (minval (a, dim = 1, mask = l2).ne.huge(pinf)) call abort
64 a(2) = 1.0
65 if (minloc (a, dim = 1, mask = l).ne.0) call abort
66 if (minval (a, dim = 1, mask = l).ne.huge(pinf)) call abort
67 if (minloc (a, dim = 1, mask = l2).ne.0) call abort
68 if (minval (a, dim = 1, mask = l2).ne.huge(pinf)) call abort
69 a(2) = minf
70 if (minloc (a, dim = 1, mask = l).ne.0) call abort
71 if (minval (a, dim = 1, mask = l).ne.huge(pinf)) call abort
72 if (minloc (a, dim = 1, mask = l2).ne.0) call abort
73 if (minval (a, dim = 1, mask = l2).ne.huge(pinf)) call abort
74 c(:) = nan
75 if (minloc (c, dim = 1, mask = l).ne.0) call abort
76 if (minval (c, dim = 1, mask = l).ne.huge(pinf)) call abort
77 if (minloc (c, dim = 1, mask = l2).ne.0) call abort
78 if (minval (c, dim = 1, mask = l2).ne.huge(pinf)) call abort
79 c(:) = pinf
80 if (minloc (c, dim = 1, mask = l).ne.0) call abort
81 if (minval (c, dim = 1, mask = l).ne.huge(pinf)) call abort
82 if (minloc (c, dim = 1, mask = l2).ne.0) call abort
83 if (minval (c, dim = 1, mask = l2).ne.huge(pinf)) call abort
84 c(1:2) = nan
85 if (minloc (c, dim = 1, mask = l).ne.0) call abort
86 if (minval (c, dim = 1, mask = l).ne.huge(pinf)) call abort
87 if (minloc (c, dim = 1, mask = l2).ne.0) call abort
88 if (minval (c, dim = 1, mask = l2).ne.huge(pinf)) call abort
89 c(2) = 1.0
90 if (minloc (c, dim = 1, mask = l).ne.0) call abort
91 if (minval (c, dim = 1, mask = l).ne.huge(pinf)) call abort
92 if (minloc (c, dim = 1, mask = l2).ne.0) call abort
93 if (minval (c, dim = 1, mask = l2).ne.huge(pinf)) call abort
94 c(2) = minf
95 if (minloc (c, dim = 1, mask = l).ne.0) call abort
96 if (minval (c, dim = 1, mask = l).ne.huge(pinf)) call abort
97 if (minloc (c, dim = 1, mask = l2).ne.0) call abort
98 if (minval (c, dim = 1, mask = l2).ne.huge(pinf)) call abort
99 l = .true.
100 l2(:) = .true.
101 a(:) = nan
102 if (minloc (a, dim = 1, mask = l).ne.1) call abort
103 if (.not.isnan(minval (a, dim = 1, mask = l))) call abort
104 if (minloc (a, dim = 1, mask = l2).ne.1) call abort
105 if (.not.isnan(minval (a, dim = 1, mask = l2))) call abort
106 a(:) = pinf
107 if (minloc (a, dim = 1, mask = l).ne.1) call abort
108 if (minval (a, dim = 1, mask = l).ne.pinf) call abort
109 if (minloc (a, dim = 1, mask = l2).ne.1) call abort
110 if (minval (a, dim = 1, mask = l2).ne.pinf) call abort
111 a(1:2) = nan
112 if (minloc (a, dim = 1, mask = l).ne.3) call abort
113 if (minval (a, dim = 1, mask = l).ne.pinf) call abort
114 if (minloc (a, dim = 1, mask = l2).ne.3) call abort
115 if (minval (a, dim = 1, mask = l2).ne.pinf) call abort
116 a(2) = 1.0
117 if (minloc (a, dim = 1, mask = l).ne.2) call abort
118 if (minval (a, dim = 1, mask = l).ne.1) call abort
119 if (minloc (a, dim = 1, mask = l2).ne.2) call abort
120 if (minval (a, dim = 1, mask = l2).ne.1) call abort
121 a(2) = minf
122 if (minloc (a, dim = 1, mask = l).ne.2) call abort
123 if (minval (a, dim = 1, mask = l).ne.minf) call abort
124 if (minloc (a, dim = 1, mask = l2).ne.2) call abort
125 if (minval (a, dim = 1, mask = l2).ne.minf) call abort
126 c(:) = nan
127 if (minloc (c, dim = 1, mask = l).ne.1) call abort
128 if (.not.isnan(minval (c, dim = 1, mask = l))) call abort
129 if (minloc (c, dim = 1, mask = l2).ne.1) call abort
130 if (.not.isnan(minval (c, dim = 1, mask = l2))) call abort
131 c(:) = pinf
132 if (minloc (c, dim = 1, mask = l).ne.1) call abort
133 if (minval (c, dim = 1, mask = l).ne.pinf) call abort
134 if (minloc (c, dim = 1, mask = l2).ne.1) call abort
135 if (minval (c, dim = 1, mask = l2).ne.pinf) call abort
136 c(1:2) = nan
137 if (minloc (c, dim = 1, mask = l).ne.3) call abort
138 if (minval (c, dim = 1, mask = l).ne.pinf) call abort
139 if (minloc (c, dim = 1, mask = l2).ne.3) call abort
140 if (minval (c, dim = 1, mask = l2).ne.pinf) call abort
141 c(2) = 1.0
142 if (minloc (c, dim = 1, mask = l).ne.2) call abort
143 if (minval (c, dim = 1, mask = l).ne.1) call abort
144 if (minloc (c, dim = 1, mask = l2).ne.2) call abort
145 if (minval (c, dim = 1, mask = l2).ne.1) call abort
146 c(2) = minf
147 if (minloc (c, dim = 1, mask = l).ne.2) call abort
148 if (minval (c, dim = 1, mask = l).ne.minf) call abort
149 if (minloc (c, dim = 1, mask = l2).ne.2) call abort
150 if (minval (c, dim = 1, mask = l2).ne.minf) call abort
151 deallocate (c)
152 allocate (c(-2:-3))
153 if (minloc (c, dim = 1).ne.0) call abort
154 if (minval (c, dim = 1).ne.huge(pinf)) call abort