From: carl love Date: Mon, 13 Sep 2021 18:02:11 +0000 (-0500) Subject: Configure,makefile and test case fixes for older powerpc targets. X-Git-Tag: VALGRIND_3_18_0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9b5f6cfeb0592cb52199cdbe3a36d173b3e32b6;p=thirdparty%2Fvalgrind.git Configure,makefile and test case fixes for older powerpc targets. 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). --- diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c index 6c8191a474..87f094c670 100644 --- a/VEX/priv/guest_ppc_helpers.c +++ b/VEX/priv/guest_ppc_helpers.c @@ -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; diff --git a/configure.ac b/configure.ac index 462068a5ac..81f2e23497 100755 --- a/configure.ac +++ b/configure.ac @@ -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 "); diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am index 61b6ec9342..9527cdf1e8 100644 --- a/none/tests/ppc64/Makefile.am +++ b/none/tests/ppc64/Makefile.am @@ -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 diff --git a/none/tests/ppc64/scv_test.c b/none/tests/ppc64/scv_test.c index d292c4be8f..39bf82aa20 100644 --- a/none/tests/ppc64/scv_test.c +++ b/none/tests/ppc64/scv_test.c @@ -1,10 +1,11 @@ #include #include #include + +#ifdef HAS_ISA_3_00 #include #include - #define ASM_INPUT_0 "0" (r0) #define INTERNAL_SYSCALL_SCV(name, nr) \ @@ -55,9 +56,13 @@ #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; } diff --git a/none/tests/ppc64/scv_test.vgtest b/none/tests/ppc64/scv_test.vgtest index 163d874a0b..93cc28c1a5 100644 --- a/none/tests/ppc64/scv_test.vgtest +++ b/none/tests/ppc64/scv_test.vgtest @@ -1,2 +1,2 @@ -prereq: +prereq: ../../../tests/check_ppc64_auxv_cap arch_3_00 prog: scv_test diff --git a/none/tests/ppc64/subnormal_test.vgtest b/none/tests/ppc64/subnormal_test.vgtest index 91c5cd6acf..098809e470 100644 --- a/none/tests/ppc64/subnormal_test.vgtest +++ b/none/tests/ppc64/subnormal_test.vgtest @@ -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 diff --git a/none/tests/ppc64/test_copy_paste.c b/none/tests/ppc64/test_copy_paste.c index 0f4659ed88..dc5f42c1a0 100644 --- a/none/tests/ppc64/test_copy_paste.c +++ b/none/tests/ppc64/test_copy_paste.c @@ -6,6 +6,8 @@ #include #include #include + +#ifdef HAS_ISA_3_00 #include /* 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; } diff --git a/none/tests/ppc64/test_darn_inst.c b/none/tests/ppc64/test_darn_inst.c index ba828a3a90..cd72fac14a 100644 --- a/none/tests/ppc64/test_darn_inst.c +++ b/none/tests/ppc64/test_darn_inst.c @@ -1,7 +1,10 @@ #include #include #include + +#ifdef HAS_ISA_3_00 #include +#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; } diff --git a/none/tests/ppc64/test_mod_instructions.c b/none/tests/ppc64/test_mod_instructions.c index 07e1cd2881..ff5d55285f 100644 --- a/none/tests/ppc64/test_mod_instructions.c +++ b/none/tests/ppc64/test_mod_instructions.c @@ -1,5 +1,6 @@ #include +#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; }