From 2ff20521f4905fd02d450c1aa3fbbcd951a4bafe Mon Sep 17 00:00:00 2001
From: Doug Gilmore <Doug.Gilmore@amd.com>
Date: Sun, 5 Aug 2012 14:40:22 -0700
Subject: [PATCH 2/2] X8664 -m32 FP compilation mode change when compiling
 with GCC.

When compiling with GCC at 32, add -mfpmath=sse -msse2, which
prevents i387 FP instructions from being generated, otherwise the
values for probabilities and frequencies can easily diverge between
the 32 and 64 bit builds of the compiler.
---
 osprey/linux/make/gcommondefs |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/osprey/linux/make/gcommondefs b/osprey/linux/make/gcommondefs
index 90fa681..e596a08 100644
--- a/osprey/linux/make/gcommondefs
+++ b/osprey/linux/make/gcommondefs
@@ -1,7 +1,7 @@
 # -*- Makefile -*-
 #
 #
-#  Copyright (C) 2009 Advanced Micro Devices, Inc.  All Rights Reserved.
+#  Copyright (C) 2009, 2012 Advanced Micro Devices, Inc.  All Rights Reserved.
 #
 #  Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
 #
@@ -200,6 +200,15 @@ ifeq ($(BUILD_ARCH), IA32)
   CCNAME  += -m32
   C++NAME += -m32
   F90 += -m32
+  ifeq ($(BUILD_COMPILER), GNU)
+    # Adding -mfpmath=sse -msse, to prevent compiler built
+    # 32 or 64 bit from producing different code in GRA.
+    # Note that -ffloat-store should be just as effective
+    # but -mfpmath=sse -msse produces better code.
+    CCNAME  += -mfpmath=sse -msse2
+    C++NAME += -mfpmath=sse -msse2
+    F90 += -mfpmath=sse -msse2
+  endif
 endif
 
 ifeq ($(BUILD_ARCH), X8664)
-- 
1.7.4.5

