]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
PowerPC, fix for conv_f16_to_double xscvhpdp assembler code
authorCarl Love <cel@us.ibm.com>
Thu, 12 Nov 2020 21:18:23 +0000 (15:18 -0600)
committerCarl Love <cel@us.ibm.com>
Mon, 16 Nov 2020 17:50:39 +0000 (11:50 -0600)
The previous commit:

  commit eb82a294573d15c1be663673d55b559a82ca29d3
  Author: Julian Seward <jseward@acm.org>
  Date:   Tue Nov 10 21:10:48 2020 +0100

      Add a missing ifdef, whose absence caused build breakage on non-POWER targets.

fixed the compile issue in conv_f16_to_double() where non-Power platforms
do not support the power xscvhpdp assembly instructions.  The instruction
is supported by ISA 3.0 platforms.  Older Power platforms still fail to
compile with the assembly instruction.  This patch fixes the if def for
power systems that do not support ISA 3.0.

Makefile.all.am
VEX/priv/guest_ppc_helpers.c
configure.ac

index 6d88670e052065c500a9956d75d86800c00d71a2..1b653667152bf423238581bf3383f5888b1d5934 100644 (file)
@@ -123,6 +123,13 @@ AM_CFLAGS_BASE = \
        -fno-strict-aliasing \
        -fno-builtin
 
+# Power ISA flag for use by guest_ppc_helpers.c
+if HAS_XSCVHPDP
+ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP
+else
+ISA_3_0_BUILD_FLAG =
+endif
+
 if COMPILER_IS_CLANG
 AM_CFLAGS_BASE += -Wno-cast-align -Wno-self-assign \
                   -Wno-tautological-compare
@@ -203,7 +210,7 @@ AM_CFLAGS_PSO_PPC64BE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
 AM_CCASFLAGS_PPC64BE_LINUX  = @FLAG_M64@ -g
 
 AM_FLAG_M3264_PPC64LE_LINUX = @FLAG_M64@
-AM_CFLAGS_PPC64LE_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE)
+AM_CFLAGS_PPC64LE_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE) $(ISA_3_0_BUILD_FLAG)
 AM_CFLAGS_PSO_PPC64LE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
 AM_CCASFLAGS_PPC64LE_LINUX  = @FLAG_M64@ -g
 
index ac4d7044a81f09cec42a7b7f0609a3e9af409827..d2410d953736b741e895d25e2b257e1d45803f57 100644 (file)
@@ -1112,7 +1112,7 @@ static ULong reinterpret_double_as_long( Double input )
 
 static Double conv_f16_to_double( ULong input )
 {
-#  if defined(__powerpc__)
+#  if defined (HAS_XSCVHPDP)
    // This all seems to be very alignment sensitive??
    __attribute__ ((aligned (64))) ULong src;
    __attribute__ ((aligned (64))) Double result;
index f01dbff7fcfae994a899f3d41b3c130bac74b063..b8378729187cf60ad8d6126ee32bc1702088038d 100755 (executable)
@@ -1640,6 +1640,20 @@ ac_asm_have_isa_3_00=no
 AC_MSG_RESULT([no])
 ])
 
+# xscvhpdp checking
+AC_MSG_CHECKING([that assembler knows xscvhpdp ])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+]], [[
+  __asm__ __volatile__("xscvhpdp 1,2 ");
+]])], [
+ac_asm_have_xscvhpdp=yes
+AC_MSG_RESULT([yes])
+], [
+ac_asm_have_xscvhpdp=no
+AC_MSG_RESULT([no])
+])
+
 # isa 3.01 checking
 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
 
@@ -1658,6 +1672,8 @@ AC_MSG_RESULT([no])
 AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \
                              -a x$HWCAP_HAS_ISA_3_00 = xyes])
 
+AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes])
+
 AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \
                              -a x$HWCAP_HAS_ISA_3_1 = xyes])