daily update on 20241226 by nitload youmu
This commit is contained in:
+82
-20
@@ -2,14 +2,42 @@
|
||||
#include "ssc_intrinsic.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#include <isa_availability.h>
|
||||
#else
|
||||
#else
|
||||
#include <cpuid.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
PRIVATE void load_intrinsic_sse(ssc_intrinsic* context);
|
||||
PRIVATE void load_intrinsic_sse(ssc_intrinsic *context);
|
||||
PRIVATE void load_intrinsic_avx(ssc_intrinsic *context);
|
||||
PRIVATE void load_intrinsic_512(ssc_intrinsic *context);
|
||||
|
||||
PRIVATE int check_isa(most_advanced_instruction instruction_family)
|
||||
{
|
||||
if (instruction_family != NEON) {
|
||||
#if _MSC_VER
|
||||
return __check_isa_support(instruction_family, 0);
|
||||
#else
|
||||
switch (instruction_family) {
|
||||
case SSE:
|
||||
return __builtin_cpu_supports("sse4.2");
|
||||
case AVX256:
|
||||
return __builtin_cpu_supports("avx2");
|
||||
case AVX512:
|
||||
return __builtin_cpu_supports("avx512f");
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
|
||||
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
SSCAPI int load_intrinsic_function(void *intrinsic_context)
|
||||
{
|
||||
@@ -17,31 +45,65 @@ SSCAPI int load_intrinsic_function(void *intrinsic_context)
|
||||
|
||||
ssc_intrinsic *context = (ssc_intrinsic *)intrinsic_context;
|
||||
|
||||
if (__check_isa_support(__IA_SUPPORT_VECTOR512,0))
|
||||
{
|
||||
|
||||
}
|
||||
else if (__check_isa_support(__IA_SUPPORT_VECTOR256, 0))
|
||||
{
|
||||
|
||||
}
|
||||
else if (__check_isa_support(__IA_SUPPORT_SSE42, 0))
|
||||
{
|
||||
if (check_isa(AVX512)) {
|
||||
load_intrinsic_512(context);
|
||||
return 3;
|
||||
} else if (check_isa(AVX256)) {
|
||||
load_intrinsic_avx(context);
|
||||
return 2;
|
||||
} else if (check_isa(SSE)) {
|
||||
load_intrinsic_sse(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return 1;
|
||||
} else if (check_isa(NEON)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void load_intrinsic_sse(ssc_intrinsic* context)
|
||||
void load_intrinsic_sse(ssc_intrinsic *context)
|
||||
{
|
||||
context->add_m2 = addmatrix2_sse;
|
||||
context->add_m3 = ;
|
||||
context->add_m4 = ;
|
||||
context->add_m3 = addmatrix3_sse;
|
||||
context->add_m4 = addmatrix4_sse;
|
||||
context->transpose_23 = transpose23;
|
||||
context->transpose_24 = transpose24;
|
||||
context->transpose_32 = transpose32;
|
||||
context->transpose_33 = transpose33;
|
||||
context->transpose_34 = transpose34;
|
||||
context->transpose_42 = transpose42;
|
||||
context->transpose_43 = transpose43;
|
||||
context->transpose_44 = transpose44;
|
||||
context->normalize_3 = normalize;
|
||||
context->det_matrix33 = det_mat3;
|
||||
context->det_matrix44 = det_mat4;
|
||||
context->string_quick_hash = quick_string_hash;
|
||||
}
|
||||
|
||||
void load_intrinsic_avx(ssc_intrinsic *context)
|
||||
{
|
||||
context->add_m2 = addmatrix2_avx;
|
||||
context->add_m3 = addmatrix3_avx;
|
||||
context->add_m4 = addmatrix4_avx;
|
||||
context->transpose_23 = transpose23;
|
||||
context->transpose_24 = transpose24;
|
||||
context->transpose_32 = transpose32;
|
||||
context->transpose_33 = transpose33;
|
||||
context->transpose_34 = transpose34;
|
||||
context->transpose_42 = transpose42;
|
||||
context->transpose_43 = transpose43;
|
||||
context->transpose_44 = transpose44;
|
||||
context->normalize_3 = normalize;
|
||||
context->det_matrix33 = det_mat3;
|
||||
context->det_matrix44 = det_mat4;
|
||||
context->string_quick_hash = quick_string_hash;
|
||||
}
|
||||
|
||||
void load_intrinsic_512(ssc_intrinsic *context)
|
||||
{
|
||||
context->add_m2 = addmatrix2_avx;
|
||||
context->add_m3 = addmatrix3_512;
|
||||
context->add_m4 = addmatrix4_512;
|
||||
context->transpose_23 = transpose23;
|
||||
context->transpose_24 = transpose24;
|
||||
context->transpose_32 = transpose32;
|
||||
|
||||
Reference in New Issue
Block a user