shithub: orca

Download patch

ref: 3e3298f94875278d712f6bb4ac7ab044fd44f0a9
parent: 32ca897ef95687a9787453b3d1fc3c80488bfa81
author: cancel <cancel@cancel.fm>
date: Mon Feb 11 04:51:03 EST 2019

Guard use of -march=nehalem to gcc >= 4.9

Fixes #14

--- a/tool
+++ b/tool
@@ -260,7 +260,24 @@
   esac
 
   case $arch in
-    x86_64) add cc_flags -march=nehalem;;
+    x86_64)
+      # 'nehalem' tuning actually produces faster code for orca than later
+      # archs, for both gcc and clang, even if it's running on a later arch
+      # CPU. This is likely due to smaller emitted code size. gcc earlier than
+      # 4.9 does not recognize the arch flag for it it, though, and I haven't
+      # tested a compiler that old, so I don't know what optimization behavior
+      # we get with it is. Just leave it at default, in that case.
+      case $cc_id in
+        gcc)
+          if cc_vers_is_gte 4.9; then
+            add cc_flags -march=nehalem
+          fi
+          ;;
+        clang)
+          add cc_flags -march=nehalem
+          ;;
+      esac
+      ;;
   esac
 
   add source_files gbuffer.c field.c mark.c bank.c sim.c