MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / validate_cpu_isa

Function validate_cpu_isa

Source/astcenccli_entry.cpp:222–257  ·  view source on GitHub ↗

* @brief Validate CPU ISA support meets the requirements of this build of the library. * * Each library build is statically compiled for a particular set of CPU ISA features, such as the * SIMD support or other ISA extensions such as POPCNT. This function checks that the host CPU * actually supports everything this build needs. * * @return Return @c true if validated, @c false otherwise. */

Source from the content-addressed store, hash-verified

220 * @return Return @c true if validated, @c false otherwise.
221 */
222static bool validate_cpu_isa()
223{
224 #if ASTCENC_AVX >= 2
225 if (!cpu_supports_avx2())
226 {
227 print_error("ERROR: Host does not support AVX2 ISA extension\n");
228 return false;
229 }
230 #endif
231
232 #if ASTCENC_F16C >= 1
233 if (!cpu_supports_f16c())
234 {
235 print_error("ERROR: Host does not support F16C ISA extension\n");
236 return false;
237 }
238 #endif
239
240 #if ASTCENC_SSE >= 41
241 if (!cpu_supports_sse41())
242 {
243 print_error("ERROR: Host does not support SSE4.1 ISA extension\n");
244 return false;
245 }
246 #endif
247
248 #if ASTCENC_POPCNT >= 1
249 if (!cpu_supports_popcnt())
250 {
251 print_error("ERROR: Host does not support POPCNT ISA extension\n");
252 return false;
253 }
254 #endif
255
256 return true;
257}
258
259// Validate Arm SVE availability
260#elif ASTCENC_SVE != 0

Callers 1

mainFunction · 0.85

Calls 6

cpu_supports_avx2Function · 0.85
cpu_supports_f16cFunction · 0.85
cpu_supports_sse41Function · 0.85
cpu_supports_popcntFunction · 0.85
cpu_supports_sveFunction · 0.85
print_errorFunction · 0.70

Tested by

no test coverage detected