debian/bin/simd-dispatch
raw| 1 | #!/bin/bash |
| 2 | |
| 3 | PKG=hhsuite |
| 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| 5 | BASE=$(realpath ${DIR}/../libexec/$PKG/$(basename "$0")) |
| 6 | |
| 7 | function test_and_run () { |
| 8 | if grep -q "$1" /proc/cpuinfo && [ -x "${BASE}-$1" ]; then |
| 9 | cmd="${BASE}-$1" |
| 10 | shift |
| 11 | # echo "${cmd}" "$@" |
| 12 | "${cmd}" "$@" |
| 13 | exit |
| 14 | fi |
| 15 | } |
| 16 | |
| 17 | for SIMD in avx2 avx sse4.1 ssse3 sse3 sse2 sse ; do test_and_run ${SIMD} "$@" ; done |
| 18 | |
| 19 | # fallback to plain option |
| 20 | $BASE-plain "$@" |