Skip to content

Commit

Permalink
Detect for amd64 revisions.
Browse files Browse the repository at this point in the history
  • Loading branch information
PoneyClairDeLune committed Feb 7, 2024
1 parent 6565251 commit a3bdff6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Acari only supports `amd64`, `armv8`, `rv64g` and their later revisions.

### CISC
<!-- - `x86`: A 32-bit only CPU architecture from Intel. -->
- `i386`: A 32-bit only CPU architecture from Intel.
- `amd64`: A 64-bit CPU architecture from AMD.
- `amd64v2`: `amd64` with extensions like SSE3.
- `amd64v3`: `amd64v2` with extensions like AVX and AVX2.
Expand Down
34 changes: 34 additions & 0 deletions src/acari/acari.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
nativeArch="$(uname -m)"
detectArch="$nativeArch"
# Arch rename
case $nativeArch in
"i386" | "i686" )
detectArch="i386"
;;
"x86_64" | "amd64")
detectArch="amd64"
;;
"arm64" | "armv8l" | "aarch64")
detectArch="arm64"
;;
"riscv64" )
detectArch="rv64"
;;
esac
# Revision match
cpuFlags=$(cat "/proc/cpuinfo")
case $detectArch in
"amd64" )
if [[ "$cpuFlags" == *"avx256"* ]]; then
detectArch="amd64v4"
elif [[ "$cpuFlags" == *"avx2"* ]]; then
detectArch="amd64v3"
elif [[ "$cpuFlags" == *"sse3"* ]]; then
detectArch="amd64v2"
fi
;;
esac
# Print the output
printf "$detectArch"
exit

0 comments on commit a3bdff6

Please sign in to comment.