about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2017-10-13 15:44:39 -0300
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2017-10-13 15:44:39 -0300
commite8dbd6a36d8e4d30e736e28a364f7a4d1404079a (patch)
treeee545720ca4998dafd23ef68f8869bcdca02957b
parent179dcdb7af4983fd42824db748ee6cb05f8d71cf (diff)
downloadglibc-e8dbd6a36d8e4d30e736e28a364f7a4d1404079a.tar.gz
glibc-e8dbd6a36d8e4d30e736e28a364f7a4d1404079a.tar.xz
glibc-e8dbd6a36d8e4d30e736e28a364f7a4d1404079a.zip
powerpc: Avoid putting floating point values in memory [BZ #22189]
	[BZ #22189]
	* sysdeps/powerpc/fpu/math_private.h (math_opt_barrier):
	(math_force_eval): Add powerpc version.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/powerpc/fpu/math_private.h7
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 500d104652..4cc53012b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-10-13  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
 
+	[BZ #22189]
+	* sysdeps/powerpc/fpu/math_private.h (math_opt_barrier):
+	(math_force_eval): Add powerpc version.
+
 	[BZ #22142]
 	* stdio-common/tst-printf.c (fp_test): Add tests for DBL_MAX and
 	-DBL_MAX.
diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h
index 396fd0562e..472182d297 100644
--- a/sysdeps/powerpc/fpu/math_private.h
+++ b/sysdeps/powerpc/fpu/math_private.h
@@ -23,6 +23,13 @@
 #include <ldsodefs.h>
 #include <dl-procinfo.h>
 #include <fenv_private.h>
+
+/* Avoid putting floating point values in memory.  */
+# define math_opt_barrier(x)					\
+  ({ __typeof (x) __x = (x); __asm ("" : "+dwa" (__x)); __x; })
+# define math_force_eval(x)						\
+  ({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "dwa" (__x)); })
+
 #include_next <math_private.h>
 
 #if defined _ARCH_PWR9 && __HAVE_DISTINCT_FLOAT128