|
From: Carl E. L. <ce...@us...> - 2015-09-15 19:55:53
|
Julian, Florian, Mark:
Mark recently found an issue with the proposed 3.11 release where the vbit test was failing on Power 6. I
have created a bugzilla for the issue, bugzilla 352765. I have created the following patch to address the
issue. If you can all review the patch, I would appreciate it.
We would like to include this in the 3.11 release. Julian, assuming the patch is OK, please let me know if
you would like me to push this into mainline so you can include it in 3.11 release or if you would like me
to wait. Thanks.
Carl Love
---------------------------------------------------------------------------------
>From b04421ef091cde6899bf158c42f1d9aa0dc0a60d Mon Sep 17 00:00:00 2001
From: Carl Love <ca...@us...>
Date: Tue, 15 Sep 2015 15:28:26 -0400
Subject: [PATCH 3/3] Add Power PC ISA check to the vbit-test
The support for the Valgrind Iops is dependent on the Power processor
support for various instructions. The instructions supported by a
given Power processor is based on the version of the ISA. The patch
add a check to the vbit-test to ensure it does not try to test an Iop
that generates an instruction on the host that is not supported.
Signed-off-by: Carl Love <ca...@us...>
---
memcheck/tests/vbit-test/irops.c | 32 +++++++++++++++++++
tests/Makefile.am | 24 +++++++++++++-
tests/min_power_isa.c | 67 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 122 insertions(+), 1 deletion(-)
create mode 100644 tests/min_power_isa.c
diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c
index d0e3b58..6feb32e 100644
--- a/memcheck/tests/vbit-test/irops.c
+++ b/memcheck/tests/vbit-test/irops.c
@@ -1143,6 +1143,38 @@ get_irop(IROp op)
return p->amd64 ? p : NULL;
#endif
#ifdef __powerpc__
+#define MIN_POWER_ISA "../../../tests/min_power_isa"
+
+ switch (op) {
+ case Iop_DivS64E:
+ case Iop_DivU64E:
+ case Iop_DivU32E:
+ case Iop_DivS32E:
+ case Iop_F64toI64U:
+ case Iop_F64toI32U:
+ case Iop_I64UtoF64:
+ case Iop_I64UtoF32:
+ case Iop_I64StoD64: {
+ int rc;
+ /* IROps require a processor that supports ISA 2.06 or newer */
+ rc = system(MIN_POWER_ISA " 2.06 ");
+ /* MIN_POWER_ISA returns 1 if underlying HW supports the
+ * specified ISA or newer.
+ */
+ if (rc == 0) return NULL;
+ if (rc > 2) {
+ fprintf(stderr,
+ " ERROR, min_power_isa() return code is invalid.\n");
+ exit(1);
+ }
+ }
+ break;
+
+ /* Other */
+ default:
+ break;
+ }
+
#ifdef __powerpc64__
return p->ppc64 ? p : NULL;
#else
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 708c28e..e3c51ab 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,26 @@
include $(top_srcdir)/Makefile.tool-tests.am
+if HAS_ISA_2_05
+ISA_2_05_FLAG = -DHAS_ISA_2_05
+else
+ISA_2_05_FLAG =
+endif
+
+if HAS_ISA_2_06
+ISA_2_06_FLAG = -DHAS_ISA_2_06
+else
+ISA_2_06_FLAG =
+endif
+
+if HAS_ISA_2_07
+ISA_2_07_FLAG = -DHAS_ISA_2_07
+else
+ISA_2_07_FLAG =
+endif
+
+min_power_isa_FLAGS = $(HAS_ISA_2_05) $(HAS_ISA_2_06) $(HAS_ISA_2_07)
+
dist_noinst_SCRIPTS = \
check_headers_and_includes \
check_makefile_consistency \
@@ -29,7 +49,8 @@ check_PROGRAMS = \
s390x_features \
mips_features \
power_insn_available \
- is_ppc64_BE
+ is_ppc64_BE \
+ min_power_isa
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
@@ -40,3 +61,4 @@ else
x86_amd64_features_CFLAGS = $(AM_CFLAGS)
endif
+min_power_isa_CFLAGS = $(min_power_isa_FLAGS)
diff --git a/tests/min_power_isa.c b/tests/min_power_isa.c
new file mode 100644
index 0000000..6fed596
--- /dev/null
+++ b/tests/min_power_isa.c
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#define TRUE 1
+#define FALSE 0
+
+/* main() */
+int main(int argc, char **argv)
+{
+ /* This program is passed in a minimum ISA that the underlying hardwre
+ * needs to support. If the HW supports this ISA or newer, return 1
+ * for true. Otherwise, return 0 for false. Return 2 for usage error.
+ */
+ int status;
+ char *min_isa;
+ int isa_level = 0;
+
+ /* set the isa_level set by the Make */
+#ifdef HWCAP_HAS_ISA_2_05
+ isa_level = 5;
+#endif
+
+#ifdef HWCAP_HAS_ISA_2_06
+ isa_level = 6;
+#endif
+
+#ifdef HWCAP_HAS_ISA_2_07
+ isa_level = 7;
+#endif
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: min_power_ISA <ISA>\n" );
+ exit(2);
+ }
+
+ min_isa = argv[1];
+
+ if (strcmp (min_isa, "2.05") == 0) {
+ if (isa_level >= 5) {
+ status = TRUE;
+ } else {
+ status = FALSE;
+ }
+
+ } else if (strcmp (min_isa, "2.06") == 0) {
+ if (isa_level >= 6) {
+ status = TRUE;
+ } else {
+ status = FALSE;
+ }
+
+ } else if (strcmp (min_isa, "2.07") == 0) {
+ if (isa_level >= 7) {
+ status = TRUE;
+ } else {
+ status = FALSE;
+ }
+
+ } else {
+ status = FALSE;
+ }
+
+ return status;
+}
--
2.1.0
|