Blame jdk8210425-rh1632174-01-compile_with_o2_and_ffp_contract_off_as_for_fdlibm.patch

Alex Kashchenko 15b15ae
diff --git openjdk.orig/hotspot/make/linux/makefiles/amd64.make openjdk/hotspot/make/linux/makefiles/amd64.make
Alex Kashchenko 15b15ae
--- openjdk.orig/hotspot/make/linux/makefiles/amd64.make
Alex Kashchenko 15b15ae
+++ openjdk/hotspot/make/linux/makefiles/amd64.make
Alex Kashchenko 15b15ae
@@ -22,10 +22,13 @@
Alex Kashchenko 15b15ae
 #  
Alex Kashchenko 15b15ae
 #
Alex Kashchenko 15b15ae
 
Alex Kashchenko 15b15ae
-# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
Alex Kashchenko 15b15ae
-OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
-# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized
Alex Kashchenko 15b15ae
-OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+ifeq ($(OPT_CFLAGS_NO_FMA),)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+else
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/SPEED) $(OPT_CFLAGS_NO_FMA)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/SPEED) $(OPT_CFLAGS_NO_FMA)
Alex Kashchenko 15b15ae
+endif
Alex Kashchenko 15b15ae
 # Must also specify if CPU is little endian
Alex Kashchenko 15b15ae
 CFLAGS += -DVM_LITTLE_ENDIAN
Alex Kashchenko 15b15ae
 
Alex Kashchenko 15b15ae
diff --git openjdk.orig/hotspot/make/linux/makefiles/gcc.make openjdk/hotspot/make/linux/makefiles/gcc.make
Alex Kashchenko 15b15ae
--- openjdk.orig/hotspot/make/linux/makefiles/gcc.make
Alex Kashchenko 15b15ae
+++ openjdk/hotspot/make/linux/makefiles/gcc.make
Alex Kashchenko 15b15ae
@@ -225,6 +225,16 @@
Alex Kashchenko 15b15ae
 OPT_CFLAGS/SIZE=-Os
Alex Kashchenko 15b15ae
 OPT_CFLAGS/SPEED=-O3
Alex Kashchenko 15b15ae
 
Alex Kashchenko 15b15ae
+ifeq ($(USE_CLANG),)
Alex Kashchenko 15b15ae
+  # Only GCC 4.6 and better have machine independent -ffp-contract=off.
Alex Kashchenko 15b15ae
+  # For other versions we need to explicitly set arch specific machine
Alex Kashchenko 15b15ae
+  # flags or keep optimization off for them.
Alex Kashchenko 15b15ae
+  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 6 \) \))" "1"
Alex Kashchenko 15b15ae
+    OPT_CFLAGS_NO_FMA = -ffp-contract=off
Alex Kashchenko 15b15ae
+  endif
Alex Kashchenko 15b15ae
+endif
Alex Kashchenko 15b15ae
+
Alex Kashchenko 15b15ae
+
Alex Kashchenko 15b15ae
 # Hotspot uses very unstrict aliasing turn this optimization off
Alex Kashchenko 15b15ae
 # This option is added to CFLAGS rather than OPT_CFLAGS
Alex Kashchenko 15b15ae
 # so that OPT_CFLAGS overrides get this option too.
Alex Kashchenko 15b15ae
diff --git openjdk.orig/hotspot/make/linux/makefiles/i486.make openjdk/hotspot/make/linux/makefiles/i486.make
Alex Kashchenko 15b15ae
--- openjdk.orig/hotspot/make/linux/makefiles/i486.make
Alex Kashchenko 15b15ae
+++ openjdk/hotspot/make/linux/makefiles/i486.make
Alex Kashchenko 15b15ae
@@ -24,10 +24,13 @@
Alex Kashchenko 15b15ae
 
Alex Kashchenko 15b15ae
 # TLS helper, assembled from .s file
Alex Kashchenko 15b15ae
 
Alex Kashchenko 15b15ae
-# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
Alex Kashchenko 15b15ae
-OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
-# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized
Alex Kashchenko 15b15ae
-OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+ifeq ($(OPT_CFLAGS_NO_FMA),)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+else
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/SPEED) $(OPT_CFLAGS_NO_FMA)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/SPEED) $(OPT_CFLAGS_NO_FMA)
Alex Kashchenko 15b15ae
+endif
Alex Kashchenko 15b15ae
 # Must also specify if CPU is little endian
Alex Kashchenko 15b15ae
 CFLAGS += -DVM_LITTLE_ENDIAN
Alex Kashchenko 15b15ae
 
Alex Kashchenko 15b15ae
diff --git openjdk.orig/hotspot/make/linux/makefiles/ppc64.make openjdk/hotspot/make/linux/makefiles/ppc64.make
Alex Kashchenko 15b15ae
--- openjdk.orig/hotspot/make/linux/makefiles/ppc64.make
Alex Kashchenko 15b15ae
+++ openjdk/hotspot/make/linux/makefiles/ppc64.make
Alex Kashchenko 15b15ae
@@ -49,3 +49,17 @@
Alex Kashchenko 15b15ae
   # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
Alex Kashchenko 15b15ae
   CFLAGS += -mcpu=power7 -mtune=power8 -minsert-sched-nops=regroup_exact -mno-multiple -mno-string
Alex Kashchenko 15b15ae
 endif
Alex Kashchenko 15b15ae
+
Alex Kashchenko 15b15ae
+ifeq ($(OPT_CFLAGS_NO_FMA),)
Alex Kashchenko 15b15ae
+  ifeq ($(OPENJDK_TARGET_CPU_ENDIAN),big)
Alex Kashchenko 15b15ae
+    OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/SPEED) -mno-fused-madd -fno-strict-aliasing
Alex Kashchenko 15b15ae
+    OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/SPEED) -mno-fused-madd -fno-strict-aliasing
Alex Kashchenko 15b15ae
+  else
Alex Kashchenko 15b15ae
+    OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+    OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT)
Alex Kashchenko 15b15ae
+  endif
Alex Kashchenko 15b15ae
+else
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/SPEED) $(OPT_CFLAGS_NO_FMA)
Alex Kashchenko 15b15ae
+  OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/SPEED) $(OPT_CFLAGS_NO_FMA)
Alex Kashchenko 15b15ae
+endif
Alex Kashchenko 15b15ae
+