Skip to content

Commit

Permalink
PHP Compiler optimization for Intel Specific Processors in 123.09beta01
Browse files Browse the repository at this point in the history
Centmin Mod already optimises PHP compilations for Intel processors if they are detected. This goes one step further for further optimisations based on detected Intel specific processors for Intel Sandy Bridge, Ivy Bridge, Haswell, Broadwell and Skylake processors
  • Loading branch information
centminmod committed Sep 30, 2016
1 parent 0221735 commit 755dd9e
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions inc/php_configure.inc
Original file line number Diff line number Diff line change
Expand Up @@ -274,32 +274,47 @@ if [[ "$GCCINTEL_PHP" = [yY] ]]; then
# intel specific
CPUVENDOR=$(cat /proc/cpuinfo | awk '/vendor_id/ {print $3}' | sort -u | head -n1)
SSECHECK=$(gcc -c -Q -march=native --help=target | awk '/ -msse/ {print $2}' | head -n1)
CPU_MARCH=$(gcc -c -Q -march=native --help=target | awk '/ -march/ {print $2}' | head -n1 )
CPUMODELNO=$(grep -v 'model name' /proc/cpuinfo | awk -F ": " '/model/ {print $2}' | uniq)
SSEFOURTWOCHECK=$(grep -o sse4_2 /proc/cpuinfo | sort -u | wc -l)
MARCHCHECK=$(gcc -c -Q -march=native --help=target | awk '/ -march=/ {print $2}' | head -n1)
gcc -c -Q -march=native --help=target | egrep '\[enabled\]|mtune|march|mfpmath' | tee ${CENTMINLOGDIR}/gcc_php_native.log
if [[ "$(uname -m)" = 'x86_64' && "$CPUVENDOR" = 'GenuineIntel' && "$SSECHECK" = '[enabled]' ]] && [[ "$CLANG_PHP" = [nN] ]]; then
CCM=64
PHP_MTUNEOPT="-m${CCM} -mtune=native -mfpmath=sse"
export CFLAGS="-O3 $PHP_MTUNEOPT"
if [[ "$CPUMODELNO" = '94' && "$CPU_MARCH" = 'broadwell' ]]; then
PHP_MTUNEOPT="-m${CCM} -march=broadwell"
elif [[ "$CPUMODELNO" = '60' && "$CPU_MARCH" = 'core-avx2' ]]; then
PHP_MTUNEOPT="-m${CCM} -march=core-avx2"
elif [[ "$CPUMODELNO" = '58' && "$CPU_MARCH" = 'core-avx-i' ]]; then
PHP_MTUNEOPT="-m${CCM} -march=core-avx-i"
elif [[ "$CPUMODELNO" = '42' && "$CPU_MARCH" = 'corei7-avx' ]]; then
PHP_MTUNEOPT="-m${CCM} -march=corei7-avx"
elif [[ "$CPUMODELNO" = '44' && "$CPU_MARCH" = 'corei7' ]]; then
PHP_MTUNEOPT="-m${CCM} -march=corei7"
else
PHP_MTUNEOPT="-m${CCM} -mtune=native -mfpmath=sse"
fi
export CFLAGS="-O3 $PHP_MTUNEOPT -pipe"
export CXXFLAGS="$CFLAGS"
elif [[ "$(uname -m)" = 'x86_64' && "$CPUVENDOR" = 'GenuineIntel' && ! -z "$(echo $MARCHCHECK | grep 'pentium')" ]] && [[ "$CLANG_PHP" = [nN] ]]; then
CCM=64
PHP_MTUNEOPT="-m${CCM} -mtune=native"
export CFLAGS="-O2 $PHP_MTUNEOPT"
export CFLAGS="-O2 $PHP_MTUNEOPT -pipe"
export CXXFLAGS="$CFLAGS"
elif [[ "$(uname -m)" = 'x86_64' && "$CPUVENDOR" = 'GenuineIntel' && "$SSECHECK" = '[disabled]' ]] && [[ "$CLANG_PHP" = [nN] ]]; then
CCM=64
PHP_MTUNEOPT="-m${CCM} -mtune=native"
export CFLAGS="-O3 $PHP_MTUNEOPT"
export CFLAGS="-O3 $PHP_MTUNEOPT -pipe"
export CXXFLAGS="$CFLAGS"
elif [[ "$(uname -m)" = 'x86_64' && "$CPUVENDOR" = 'GenuineIntel' && -z "$SSECHECK" ]] && [[ "$CLANG_PHP" = [nN] ]]; then
CCM=64
PHP_MTUNEOPT="-m${CCM} -mtune=generic"
export CFLAGS="-O2 $PHP_MTUNEOPT"
export CFLAGS="-O2 $PHP_MTUNEOPT -pipe"
export CXXFLAGS="$CFLAGS"
elif [[ "$(uname -m)" != 'x86_64' && "$CPUVENDOR" = 'GenuineIntel' ]] && [[ "$CLANG_PHP" = [nN] ]]; then
CCM=32
PHP_MTUNEOPT="-m${CCM} -mtune=generic"
export CFLAGS="-O2 $PHP_MTUNEOPT"
export CFLAGS="-O2 $PHP_MTUNEOPT -pipe"
export CXXFLAGS="$CFLAGS"
else
PHP_MTUNEOPT=""
Expand Down

0 comments on commit 755dd9e

Please sign in to comment.