@@ -133,7 +133,24 @@ template <typename DataT, int NumElems> std::vector<DataT> generate_ref_data() {
133
133
134
134
std::vector<DataT> ref_data{};
135
135
136
- if constexpr (std::is_signed_v<DataT>) {
136
+ if constexpr (type_traits::is_sycl_floating_point_v<DataT>) {
137
+ static const DataT nan = value<DataT>::nan ();
138
+ static const DataT inf = value<DataT>::inf ();
139
+
140
+ ref_data.reserve ((NumElems > 1 ) ? NumElems : 6 );
141
+
142
+ // We are using the `double` literals to avoid precision loss for case of
143
+ // the `double` DataT on unexact values like 0.1
144
+ ref_data.insert (ref_data.end (), {-inf, nan, min, max, -0.0 , 0.1 });
145
+ if constexpr (NumElems != 1 ) {
146
+ ref_data.insert (ref_data.end (), {-0.1 , +0.0 });
147
+ for (size_t i = ref_data.size (); i < NumElems; ++i) {
148
+ // Store values with exact representation of the fraction part for
149
+ // every floating point type
150
+ ref_data.push_back (i + 0.25 );
151
+ }
152
+ }
153
+ } else if constexpr (std::is_signed_v<DataT>) {
137
154
ref_data.reserve ((NumElems > 1 ) ? NumElems : 5 );
138
155
139
156
ref_data.insert (ref_data.end (), {min, min_half, max, max_half, 0 });
@@ -143,9 +160,8 @@ template <typename DataT, int NumElems> std::vector<DataT> generate_ref_data() {
143
160
ref_data.push_back (i);
144
161
}
145
162
}
146
- }
147
-
148
- if constexpr (std::is_unsigned_v<DataT>) {
163
+ } else {
164
+ // Unsigned integral type
149
165
ref_data.reserve ((NumElems > 1 ) ? NumElems : 3 );
150
166
151
167
ref_data.insert (ref_data.end (), {max, max_half, 0 });
@@ -156,26 +172,6 @@ template <typename DataT, int NumElems> std::vector<DataT> generate_ref_data() {
156
172
}
157
173
}
158
174
}
159
-
160
- if constexpr (type_traits::is_sycl_floating_point_v<DataT>) {
161
- static const DataT nan = value<DataT>::nan ();
162
- static const DataT inf = value<DataT>::inf ();
163
-
164
- ref_data.reserve ((NumElems > 1 ) ? NumElems : 6 );
165
-
166
- // We are using the `double` literals to avoid precision loss for case of
167
- // the `double` DataT on unexact values like 0.1
168
- ref_data.insert (ref_data.end (), {-inf, nan, min, max, -0.0 , 0.1 });
169
- if constexpr (NumElems != 1 ) {
170
- ref_data.insert (ref_data.end (), {-0.1 , +0.0 });
171
- for (size_t i = ref_data.size (); i < NumElems; ++i) {
172
- // Store values with exact representation of the fraction part for
173
- // every floating point type
174
- ref_data.push_back (i + 0.25 );
175
- }
176
- }
177
- }
178
-
179
175
return ref_data;
180
176
}
181
177
0 commit comments