Skip to content

Commit 13e347c

Browse files
committed
Add m4 support
1 parent d2ad069 commit 13e347c

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

include/uarch.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ enum uarch {
77

88
// arm64
99
// apple
10+
// m1
1011
firestorm,
1112
icestorm,
13+
// m2
1214
avalanche,
1315
blizzard,
16+
// m4
17+
m4_pcore,
18+
m4_ecore,
1419
// qualcomm
1520
oryon,
1621
// arm

src/detect_uarch.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,38 @@ int main() {
66
enum uarch uarch = get_uarch();
77
switch (uarch) {
88
case firestorm:
9+
printf("-DAPPLE_SILICON\n");
10+
printf("-DAPPLE_PCORE\n");
911
printf("-DAPPLE_M1\n");
1012
printf("-DAPPLE_M1_FIRESTORM\n");
1113
break;
1214
case icestorm:
15+
printf("-DAPPLE_SILICON\n");
1316
printf("-DAPPLE_M1\n");
1417
printf("-DAPPLE_M1_ICESTORM\n");
1518
break;
1619
case avalanche:
20+
printf("-DAPPLE_SILICON\n");
21+
printf("-DAPPLE_PCORE\n");
1722
printf("-DAPPLE_M2\n");
1823
printf("-DAPPLE_M2_AVALANCHE\n");
1924
break;
2025
case blizzard:
26+
printf("-DAPPLE_SILICON\n");
2127
printf("-DAPPLE_M2\n");
2228
printf("-DAPPLE_M2_BLIZZARD\n");
2329
break;
30+
case m4_pcore:
31+
printf("-DAPPLE_SILICON\n");
32+
printf("-DAPPLE_PCORE\n");
33+
printf("-DAPPLE_M4\n");
34+
printf("-DAPPLE_M4_PCORE\n");
35+
break;
36+
case m4_ecore:
37+
printf("-DAPPLE_SILICON\n");
38+
printf("-DAPPLE_M4\n");
39+
printf("-DAPPLE_M4_ECORE\n");
40+
break;
2441
case oryon:
2542
printf("-DQUALCOMM_ORYON\n");
2643
break;
@@ -34,6 +51,7 @@ int main() {
3451
printf("-DARM_CORTEX_X1\n");
3552
break;
3653
case neoverse_n1:
54+
printf("-DNO_FJCVTZS\n");
3755
printf("-DARM_NEOVERSE_N1\n");
3856
break;
3957
case neoverse_v1:

src/uarch.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ enum uarch get_uarch_inner() {
163163

164164
fprintf(stderr, "Configured for Apple M2 Avalanche\n");
165165
return avalanche;
166+
} else if (strcmp(buf, "0x6f5129ac\n") == 0) {
167+
fprintf(stderr, "Apple M4 detected\n");
168+
169+
fprintf(stderr, "Configured for Apple M4 P core\n");
170+
return m4_pcore;
166171
}
167172
#endif
168173

0 commit comments

Comments
 (0)