2 * An extra testcase for bug484426
3 * The testcase supplied only tests single precision frinta
10 void test_frinta(T input
, T expected
)
15 if constexpr (std::is_same_v
<double, T
> == true)
24 assert(result
== expected
);
35 assert(result
== expected
);
40 void test_frinta_fullvec(T
* input
, T
* expected
)
42 T result
[2*sizeof(double)/sizeof(T
)];
44 if constexpr (std::is_same_v
<double, T
> == true)
48 "frinta v22.2d, v23.2d;\n"
52 : "memory", "v22", "v23");
53 assert(result
[0] == expected
[0]);
54 assert(result
[1] == expected
[1]);
60 "frinta v22.4s, v23.4s;\n"
64 : "memory", "v22", "v23");
65 assert(result
[0] == expected
[0]);
66 assert(result
[1] == expected
[1]);
67 assert(result
[2] == expected
[2]);
68 assert(result
[3] == expected
[3]);
72 void test_frinta_halfvec(float* input
, float* expected
)
78 "frinta v22.2s, v23.2s;\n"
82 : "memory", "v22", "v23");
83 assert(result
[0] == expected
[0]);
84 assert(result
[1] == expected
[1]);
89 void test_frintn(T input
, T expected
)
94 if constexpr (std::is_same_v
<double, T
> == true)
103 assert(result
== expected
);
107 __asm__
__volatile__(
114 assert(result
== expected
);
119 void test_frintn_fullvec(T
* input
, T
* expected
)
121 T result
[2*sizeof(double)/sizeof(T
)];
123 if constexpr (std::is_same_v
<double, T
> == true)
125 __asm__
__volatile__(
127 "frintn v22.2d, v23.2d;\n"
131 : "memory", "v22", "v23");
132 assert(result
[0] == expected
[0]);
133 assert(result
[1] == expected
[1]);
137 __asm__
__volatile__(
139 "frintn v22.4s, v23.4s;\n"
143 : "memory", "v22", "v23");
144 assert(result
[0] == expected
[0]);
145 assert(result
[1] == expected
[1]);
146 assert(result
[2] == expected
[2]);
147 assert(result
[3] == expected
[3]);
151 void test_frintn_halfvec(float* input
, float* expected
)
155 __asm__
__volatile__(
157 "frintn v22.2s, v23.2s;\n"
161 : "memory", "v22", "v23");
162 assert(result
[0] == expected
[0]);
163 assert(result
[1] == expected
[1]);
168 // round "away from zero"
169 test_frinta(1.5, 2.0);
170 test_frinta(2.5, 3.0);
171 test_frinta(-1.5, -2.0);
172 test_frinta(-2.5, -3.0);
173 test_frinta(1.5F
, 2.0F
);
174 test_frinta(2.5F
, 3.0F
);
175 test_frinta(-1.5F
, -2.0F
);
176 test_frinta(-2.5F
, -3.0F
);
178 double in1
[] = {1.5, 1.5};
179 double out1
[] = {2.0, 2,0};
180 test_frinta_fullvec(in1
, out1
);
181 double in2
[] = {2.5, 2.5};
182 double out2
[] = {3.0, 3,0};
183 test_frinta_fullvec(in2
, out2
);
184 double in3
[] = {-1.5, -1.5};
185 double out3
[] = {-2.0, -2,0};
186 test_frinta_fullvec(in3
, out3
);
187 double in4
[] = {-2.5, -2.5};
188 double out4
[] = {-3.0, -3,0};
189 test_frinta_fullvec(in4
, out4
);
191 float in1f
[] = {1.5F
, 1.5F
, 1.5F
, 1.5F
};
192 float out1f
[] = {2.0F
, 2.0F
, 2.0F
, 2.0F
};
193 test_frinta_fullvec(in1f
, out1f
);
194 test_frinta_halfvec(in1f
, out1f
);
195 float in2f
[] = {2.5F
, 2.5F
, 2.5F
, 2.5F
};
196 float out2f
[] = {3.0F
, 3.0F
, 3.0F
, 3.0F
};
197 test_frinta_fullvec(in2f
, out2f
);
198 test_frinta_halfvec(in2f
, out2f
);
199 float in3f
[] = {-1.5F
, -1.5F
, -1.5F
, -1.5F
};
200 float out3f
[] = {-2.0F
, -2.0F
, -2.0F
, -2.0F
};
201 test_frinta_fullvec(in3f
, out3f
);
202 test_frinta_halfvec(in3f
, out3f
);
203 float in4f
[] = {-2.5F
, -2.5F
, -2.5F
, -2.5F
};
204 float out4f
[] = {-3.0F
, -3.0F
, -3.0F
, -3.0F
};
205 test_frinta_fullvec(in4f
, out4f
);
206 test_frinta_halfvec(in4f
, out4f
);
209 test_frintn(1.5, 2.0);
210 test_frintn(2.5, 2.0);
211 test_frintn(-1.5, -2.0);
212 test_frintn(-2.5, -2.0);
213 test_frintn(1.5F
, 2.0F
);
214 test_frintn(2.5F
, 2.0F
);
215 test_frintn(-1.5F
, -2.0F
);
216 test_frintn(-2.5F
, -2.0F
);
218 test_frintn_fullvec(in1
, out1
);
219 test_frintn_fullvec(in2
, out1
);
220 test_frintn_fullvec(in3
, out3
);
221 test_frintn_fullvec(in4
, out3
);
223 test_frintn_fullvec(in1f
, out1f
);
224 test_frintn_halfvec(in1f
, out1f
);
225 test_frintn_fullvec(in2f
, out1f
);
226 test_frintn_halfvec(in2f
, out1f
);
227 test_frintn_fullvec(in3f
, out3f
);
228 test_frintn_halfvec(in3f
, out3f
);
229 test_frintn_fullvec(in4f
, out3f
);
230 test_frintn_halfvec(in4f
, out3f
);