From e23c2a2291071d1443ff9c6dbce5bbfe2c4cdd7c Mon Sep 17 00:00:00 2001 From: Carl Love Date: Fri, 17 Sep 2021 00:33:14 +0000 Subject: [PATCH] Fixes to add .machine directives for assembly instructions --- VEX/priv/guest_ppc_helpers.c | 4 +++- configure.ac | 9 ++++++--- none/tests/ppc64/Makefile.am | 2 +- none/tests/ppc64/scv_test.c | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c index 689aa8f34e..54318b6d5c 100644 --- a/VEX/priv/guest_ppc_helpers.c +++ b/VEX/priv/guest_ppc_helpers.c @@ -1899,7 +1899,9 @@ static Double conv_f16_to_double( ULong input ) __attribute__ ((aligned (64))) ULong src; __attribute__ ((aligned (64))) Double result; src = input; - __asm__ __volatile__ ("xscvhpdp %x0,%x1" : "=wa" (result) : "wa" (src)); + __asm__ __volatile__ (".machine push;\n" ".machine power9;\n" \ + "xscvhpdp %x0,%x1 ;\n .machine pop" \ + : "=wa" (result) : "wa" (src) ); return result; # else return 0.0; diff --git a/configure.ac b/configure.ac index 81f2e23497..d755b0248b 100755 --- a/configure.ac +++ b/configure.ac @@ -1658,7 +1658,8 @@ AC_MSG_CHECKING([that assembler knows ISA 3.00 ]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ - __asm__ __volatile__("cnttzw 1,2 "); +__asm__ __volatile__ (".machine power9;\n" \ + "cnttzw 1,3; \n" ); ]])], [ # guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste, # cpabort support @@ -1677,7 +1678,8 @@ AC_MSG_CHECKING([that assembler knows xscvhpdp ]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ - __asm__ __volatile__("xscvhpdp 1,2 "); +__asm__ __volatile__ (".machine power9;\n" \ + "xscvhpdp 1,2;\n" ); ]])], [ ac_asm_have_xscvhpdp=yes AC_MSG_RESULT([yes]) @@ -1704,7 +1706,8 @@ AC_MSG_RESULT([no]) AC_MSG_CHECKING([that assembler knows ISA 3.1 ]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ - __asm__ __volatile__("brh 1,2 "); +__asm__ __volatile__ (".machine power10;\n" \ + "brh 1,2;\n "); ]])], [ ac_asm_have_isa_3_1=yes AC_MSG_RESULT([yes]) diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am index 15e90ebfdb..1e5398575f 100644 --- a/none/tests/ppc64/Makefile.am +++ b/none/tests/ppc64/Makefile.am @@ -147,7 +147,7 @@ HTM_FLAG = endif if HAS_ISA_3_00 -BUILD_FLAGS_ISA_3_00 = -mcpu=power8 +BUILD_FLAGS_ISA_3_00 = -mcpu=power9 ISA_3_00_FLAG = -DHAS_ISA_3_00 else BUILD_FLAGS_ISA_3_00 = diff --git a/none/tests/ppc64/scv_test.c b/none/tests/ppc64/scv_test.c index 39bf82aa20..5c8df226f4 100644 --- a/none/tests/ppc64/scv_test.c +++ b/none/tests/ppc64/scv_test.c @@ -19,7 +19,8 @@ register long int r8 __asm__ ("r8"); \ r0=name; \ __asm__ __volatile__ \ - ("scv 0\n\t" \ + (".machine power9\n" \ + "scv 0\n\t" \ "0:" \ : "=&r" (r0), \ "=&r" (r3), "=&r" (r4), "=&r" (r5), \ -- 2.47.2