summarylogtreecommitdiffstats
path: root/choose-gcc-optimization.sh
diff options
context:
space:
mode:
authorFigue2017-11-26 00:45:58 +0100
committerFigue2017-11-26 00:45:58 +0100
commit6193bf142193e3931a7fc14ad62f53b6817a264e (patch)
treec3921454a602532e96ab23b6b3c65f3b77034fd8 /choose-gcc-optimization.sh
parent9f0023439f83f549a3a7029eeaee450336b6b577 (diff)
downloadaur-6193bf142193e3931a7fc14ad62f53b6817a264e.tar.gz
4.14.2-6-xanmod4. Added GCC optimization script
Diffstat (limited to 'choose-gcc-optimization.sh')
-rwxr-xr-xchoose-gcc-optimization.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/choose-gcc-optimization.sh b/choose-gcc-optimization.sh
new file mode 100755
index 000000000000..83869b51d0e7
--- /dev/null
+++ b/choose-gcc-optimization.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+Detect_CPU=$(gcc -c -Q -march=native --help=target | grep march | awk '{print $2}')
+
+echo -e " ** Detected CPU architecture: $Detect_CPU **\n"
+
+cat << EOF
+
+ Available CPU microarchitectures:
+
+ 1) AMD old K8-family
+ 2) AMD Improved K8-family (SSE3)
+ 3) AMD K10-family
+ 4) AMD Family 10h (Barcelona)
+ 5) AMD Family 14h (Bobcat)
+ 6) AMD Family 16h (Jaguar)
+ 7) AMD Family 15h (Bulldozer)
+ 8) AMD Family 15h (Piledriver)
+ 9) AMD Family 15h (Steamroller)
+ 10) AMD Family 15h (Excavator)
+ 11) AMD Family 17h (Zen)
+
+ 12) Intel P4 / older Netburst based Xeon (Core2)
+ 13) Intel Bonnell family of low-power Atom processors (Bonnell)
+ 14) Intel Silvermont family of low-power Atom processors (Silvermont)
+ 15) Intel 1st Gen Core i3/i5/i7-family (Nehalem)
+ 16) Intel 1.5 Gen Core i3/i5/i7-family (Westmere)
+ 17) Intel 2nd Gen Core i3/i5/i7-family (Sandybridge)
+ 18) Intel 3rd Gen Core i3/i5/i7-family (Ivybridge)
+ 19) Intel 4th Gen Core i3/i5/i7-family (Haswell)
+ 20) Intel 5th Gen Core i3/i5/i7-family (Broadwell)
+ 21) Intel 6th Gen Core i3/i5/i7-family (Skylake)
+
+ 22) Native optimizations autodetected by GCC
+
+ 0) Generic (default)
+
+EOF
+
+read -p " Which config you want? " answer
+case $answer in
+ 1) Microarchitecture=CONFIG_MK8 ;;
+ 2) Microarchitecture=CONFIG_MK8SSE3 ;;
+ 3) Microarchitecture=CONFIG_MK10 ;;
+ 4) Microarchitecture=CONFIG_MBARCELONA ;;
+ 5) Microarchitecture=CONFIG_MBOBCAT ;;
+ 6) Microarchitecture=CONFIG_MJAGUAR ;;
+ 7) Microarchitecture=CONFIG_MBULLDOZER ;;
+ 8) Microarchitecture=CONFIG_MPILEDRIVER ;;
+ 9|10|11) Microarchitecture=CONFIG_MNATIVE ;; # Xanmod doesn't include those architectures!! Switch to native instead
+ 12) Microarchitecture=CONFIG_MPSC ;;
+ 13) Microarchitecture=CONFIG_MATOM ;;
+ 14) Microarchitecture=CONFIG_MSILVERMONT ;;
+ 15) Microarchitecture=CONFIG_MNEHALEM ;;
+ 16) Microarchitecture=CONFIG_MWESTMERE ;;
+ 17) Microarchitecture=CONFIG_MSANDYBRIDGE ;;
+ 18) Microarchitecture=CONFIG_MIVYBRIDGE ;;
+ 19) Microarchitecture=CONFIG_MHASWELL ;;
+ 20) Microarchitecture=CONFIG_MBROADWELL ;;
+ 21) Microarchitecture=CONFIG_MNATIVE ;; # Xanmod doesn't include this architecture!! Switch to native instead
+ 22) Microarchitecture=CONFIG_MNATIVE ;;
+ *) true ;;
+esac
+
+sed -e 's|^CONFIG_GENERIC_CPU=y|# CONFIG_GENERIC_CPU is not set|g' -i .config
+sed -e "s|^# $Microarchitecture is not set|$Microarchitecture=y|g" -i .config
+
+echo