]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Configure,makefile and test case fixes for older powerpc targets.
authorcarl love <cel@us.ibm.com>
Mon, 13 Sep 2021 18:02:11 +0000 (13:02 -0500)
committerCarl Love <cel@us.ibm.com>
Thu, 30 Sep 2021 22:29:54 +0000 (17:29 -0500)
Assorted changes to fix up compile issues as seen during regression
testing of VG on hardware back as far as Power 6 (ISA 2.05).

VEX/priv/guest_ppc_helpers.c
configure.ac
none/tests/ppc64/Makefile.am
none/tests/ppc64/scv_test.c
none/tests/ppc64/scv_test.vgtest
none/tests/ppc64/subnormal_test.vgtest
none/tests/ppc64/test_copy_paste.c
none/tests/ppc64/test_darn_inst.c
none/tests/ppc64/test_mod_instructions.c

index 6c8191a474c6a0e5caaa40a28d0920128433f0b6..87f094c6703d58351300a86b173277905b0177f6 100644 (file)
@@ -3164,7 +3164,8 @@ VexGuestLayout
         };
 
 UInt copy_paste_abort_dirty_helper(UInt addr, UInt op) {
-#  if defined(__powerpc__)
+#  if defined(__powerpc__) && defined(HAS_ISA_3_00)
+/* The enable copy, paste., and cpabort were introduced in ISA 3.0. */
    ULong ret;
    UInt cr;
 
index 462068a5ac22134e2e222fc53e9a00573cfeabf0..81f2e234977b1ded48ecb30a7adfc8f9e959e86b 100755 (executable)
@@ -1660,12 +1660,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 ]], [[
   __asm__ __volatile__("cnttzw 1,2 ");
 ]])], [
+# guest_ppc_helpers.c needs the HAS_ISA_3_OO to enable copy, paste,
+# cpabort support
+safe_CFLAGS=$CFLAGS
+CFLAGS="-DHAS_ISA_3_00"
 ac_asm_have_isa_3_00=yes
 AC_MSG_RESULT([yes])
 ], [
 ac_asm_have_isa_3_00=no
 AC_MSG_RESULT([no])
 ])
+CFLAGS=$safe_CFLAGS
 
 # xscvhpdp checking
 AC_MSG_CHECKING([that assembler knows xscvhpdp ])
@@ -1697,7 +1702,6 @@ AC_MSG_RESULT([no])
 
 # isa 3.01 checking
 AC_MSG_CHECKING([that assembler knows ISA 3.1 ])
-
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 ]], [[
   __asm__ __volatile__("brh 1,2 ");
index 61b6ec93422b0d590aa82ed90a2865d555075662..9527cdf1e8f63a6cff0afbf810f5acb18430b7ba 100644 (file)
@@ -88,11 +88,16 @@ AM_CCASFLAGS += @FLAG_M64@
 
 allexec_CFLAGS         = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@
 
+scv_test_SOURCES = scv_test.c
+test_copy_paste_SOURCES = test_copy_paste.c
+test_mod_instructions_SOURCES = test_mod_instructions.c
+test_isa_3_0_SOURCES = test_isa_3_0.c
 test_isa_3_1_XT_SOURCES = test_isa_3_1_XT.c test_isa_3_1_common.c
 test_isa_3_1_RT_SOURCES = test_isa_3_1_RT.c test_isa_3_1_common.c
 test_isa_3_1_VRT_SOURCES = test_isa_3_1_VRT.c test_isa_3_1_common.c
 test_isa_3_1_Misc_SOURCES = test_isa_3_1_Misc.c test_isa_3_1_common.c
 test_isa_3_1_AT_SOURCES = test_isa_3_1_AT.c test_isa_3_1_common.c
+test_darn_inst_SOURCES = test_darn_inst.c
 
 if HAS_ALTIVEC
 BUILD_FLAG_ALTIVEC = -maltivec
@@ -111,7 +116,8 @@ BUILD_FLAG_VSX =
 endif
 
 if HAS_DFP
-BUILD_FLAGS_DFP = -mhard-dfp -mcpu=power6
+# The DFP test uses the Power7 dcffix instruction.
+BUILD_FLAGS_DFP = -mhard-dfp -mcpu=power7
 DFP_FLAG = -DHAS_DFP
 else
 BUILD_FLAGS_DFP =
@@ -192,6 +198,12 @@ test_touch_tm_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG)
 test_isa_3_0_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_00_FLAG) \
                        @FLAG_M64@ $(BUILD_FLAGS_ISA_3_00)
 
+scv_test_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_00_FLAG) \
+                       @FLAG_M64@ $(BUILD_FLAGS_ISA_3_00)
+
+test_mod_instructions_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_00_FLAG) \
+                       @FLAG_M64@ $(BUILD_FLAGS_ISA_3_00)
+
 test_darn_inst_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_00_FLAG) \
                        @FLAG_M64@ $(BUILD_FLAGS_ISA_3_00)
 
@@ -206,8 +218,8 @@ test_isa_3_1_AT_CFLAGS = $(test_isa_3_1_CFLAGS)
 subnormal_test_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_FLAG) $(ISA_2_06_FLAG) \
                        @FLAG_M64@ $(ALTIVEC_FLAG) $(BUILD_FLAG_VSX) $(BUILD_FLAGS_ISA_2_06)
 
-test_copy_paste_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_FLAG) $(ISA_3_1_FLAG) \
-                       @FLAG_M64@ $(ALTIVEC_FLAG) $(BUILD_FLAG_VSX) $(BUILD_FLAGS_ISA_3_1)
+test_copy_paste_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_00_FLAG) \
+                       @FLAG_M64@ $(BUILD_FLAGS_ISA_3_00)
 
 test_isa_2_06_part3_LDADD = -lm
 test_dfp1_LDADD = -lm
index d292c4be8fcfd39045efc8784fabfb5704c46b1e..39bf82aa2074cb8a3a0687cb13b98dec9c60c551 100644 (file)
@@ -1,10 +1,11 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
+
+#ifdef HAS_ISA_3_00
 #include <asm/unistd.h>
 #include <sys/auxv.h>
 
-
 #define ASM_INPUT_0 "0" (r0)
 
 #define INTERNAL_SYSCALL_SCV(name, nr) \
 
 #define PPC_FEATURE2_SCV           0x00100000 /* scv syscall enabled */
 
+#endif
+
 int
 main(void)
 {
+
+#ifdef HAS_ISA_3_00
   int result;
   unsigned long hwcaps2_val;
 
@@ -81,5 +86,8 @@ main(void)
   }
 
   printf("Success\n");
+#else
+  printf("HAS_ISA_3_00 not detected.\n");
+#endif
   return 0;
 }
index 163d874a0b6198577c8b84037116e6ce90a36d68..93cc28c1a548211b6dd8c0d99929c676e5102c4b 100644 (file)
@@ -1,2 +1,2 @@
-prereq:
+prereq: ../../../tests/check_ppc64_auxv_cap arch_3_00
 prog: scv_test
index 91c5cd6acfd598482b84cc7ad55eee97598c4ea6..098809e470dfe49504a052e4fc1b7802ce98d96d 100644 (file)
@@ -1,2 +1,2 @@
-prereq: ../../../tests/check_ppc64_auxv_cap altivec
+prereq: ../../../tests/check_ppc64_auxv_cap altivec && ../../../tests/check_ppc64_auxv_cap arch_2_06
 prog: subnormal_test
index 0f4659ed88d9919ac7551aa9bdf0c59e27778d00..dc5f42c1a08dc835cf69e6b6f72fa26d4c78879c 100644 (file)
@@ -6,6 +6,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <malloc.h>
+
+#ifdef HAS_ISA_3_00
 #include <altivec.h>
 
 /* return CR0 in least significant bits */
@@ -33,9 +35,11 @@ void test_cpabort (void)
 #define FAILURE 2
 #define DEBUG 0
 #define PASTE_ERROR 0
+#endif
 
 int main()
 {
+#ifdef HAS_ISA_3_00
    int i;
    unsigned int cc_value;
    int result = SUCCESS;
@@ -106,5 +110,8 @@ int main()
    else
       printf("FAILURE.\n");
 
+#else
+  printf("HAS_ISA_3_00 not detected.\n");
+#endif
    return 0;
 }
index ba828a3a90993471b66d6a63547dce03ba2d8c15..cd72fac14a3312b9443e553865a8ae971fa8388f 100644 (file)
@@ -1,7 +1,10 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
+
+#ifdef HAS_ISA_3_00
 #include <altivec.h>
+#endif
 
 #define TRUE  1
 #define FALSE 0
@@ -9,6 +12,7 @@
 
 int main()
 {
+#ifdef HAS_ISA_3_00
   unsigned long long rand;
   int success = TRUE;
 
@@ -38,5 +42,8 @@ int main()
   else
      printf("Failure.\n");
 
+#else
+  printf("HAS_ISA_3_00 not detected.\n");
+#endif
   return 0;
 }
index 07e1cd2881c14e2df7077c5a25c1d722dc6a9e8b..ff5d55285f0ebb1292b0a6899f4770f473cf3c9b 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 
+#ifdef HAS_ISA_3_00
 long test_modsd( long srcA, long srcB)
 {
   long dst;
@@ -31,9 +32,11 @@ unsigned test_moduw( unsigned srcA, unsigned srcB)
 
    return dst;
 }
+#endif
 
 int main()
 {
+#ifdef HAS_ISA_3_00
    int srcA_si, srcB_si, dst_si;
    unsigned int srcA_ui, srcB_ui, dst_ui;
    long srcA_sl, srcB_sl, dst_sl;
@@ -245,7 +248,9 @@ int main()
         printf ("modud result = %lu\n", dst_ul);
 #endif
        }
-
+#else
+  printf("HAS_ISA_3_00 not detected.\n");
+#endif  // HAS_ISA_3_0
    return 0;
 }