Skip to content

Commit

Permalink
add x86 APX features (#1482)
Browse files Browse the repository at this point in the history
add apx features Update cpu_detect.c3
  • Loading branch information
alex-s168 authored Sep 25, 2024
1 parent b47201f commit da2f958
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/std/core/private/cpu_detect.c3
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum X86Feature
AMX_FP16,
AMX_INT8,
AMX_TILE,
APXF,
AVX,
AVX10_1_256,
AVX10_1_512,
Expand Down Expand Up @@ -156,6 +157,7 @@ fn void x86_initialize_cpu_features()
add_feature_if_bit(AMX_FP16, leaf7s1.eax, 21);
add_feature_if_bit(AMX_INT8, leaf7.edx, 25);
add_feature_if_bit(AMX_TILE, leaf7.edx, 24);
add_feature_if_bit(APXF, leaf7s1.edx, 21);
add_feature_if_bit(AVX, feat.ecx, 28);
add_feature_if_bit(AVX10_1_256, leaf7s1.edx, 19);
add_feature_if_bit(AVX10_1_512, leaf_24.ebx, 18);
Expand Down Expand Up @@ -255,4 +257,4 @@ fn void x86_initialize_cpu_features()
add_feature_if_bit(XSAVEOPT, leaf_d.eax, 0);
add_feature_if_bit(XSAVES, leaf_d.eax, 3);

}
}
8 changes: 8 additions & 0 deletions src/compiler/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,14 @@ typedef enum
X86_FEAT_AMX_FP16,
X86_FEAT_AMX_INT8,
X86_FEAT_AMX_TILE,
X86_FEAT_APX_EGPR,
X86_FEAT_APX_PUSH2POP2,
X86_FEAT_APX_PPX,
X86_FEAT_APX_NDD,
X86_FEAT_APX_CCMP,
X86_FEAT_APX_NF,
X86_FEAT_APX_CF,
X86_FEAT_APX_ZU,
X86_FEAT_AVX,
X86_FEAT_AVX10_1_512,
X86_FEAT_AVX10_1_256,
Expand Down
18 changes: 17 additions & 1 deletion src/compiler/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,15 @@ static char *x86_feature_name[] = {
[X86_FEAT_SSSE3] = "ssse3",
[X86_FEAT_SSE4_1] = "sse4.1",
[X86_FEAT_SSE4_2] = "sse4.2",
[X86_FEAT_AVX] = "avx",
[X86_FEAT_APX_EGPR] = "egpr",
[X86_FEAT_APX_PUSH2POP2] = "push2pop2",
[X86_FEAT_APX_PPX] = "ppx",
[X86_FEAT_APX_NDD] = "ndd",
[X86_FEAT_APX_CCMP] = "ccmp",
[X86_FEAT_APX_NF] = "nf",
[X86_FEAT_APX_CF] = "cf",
[X86_FEAT_APX_ZU] = "zu",
[X86_FEAT_AVX] = "avx",
[X86_FEAT_AVX2] = "avx2",
[X86_FEAT_AVX10_1_512] = "avx10.1-512",
[X86_FEAT_AVX10_1_256] = "avx10.1-256",
Expand Down Expand Up @@ -667,6 +675,14 @@ static void x86_features_add_feature(X86Features *cpu_features, X86Feature featu
case X86_FEAT_XSAVE:
case X86_FEAT_EVEX512:
case X86_FEAT_USERMSR:
case X86_FEAT_APX_EGPR:
case X86_FEAT_APX_PUSH2POP2:
case X86_FEAT_APX_PPX:
case X86_FEAT_APX_NDD:
case X86_FEAT_APX_CCMP:
case X86_FEAT_APX_NF:
case X86_FEAT_APX_CF:
case X86_FEAT_APX_ZU:
return;
case X86_FEAT_AVX10_1_512:
x86_features_add_feature(cpu_features, X86_FEAT_AVX10_1_256);
Expand Down

0 comments on commit da2f958

Please sign in to comment.