* @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. */
| 220 | * @return Return @c true if validated, @c false otherwise. |
| 221 | */ |
| 222 | static 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 |
no test coverage detected