]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Valgrind-side changes to fix bug #271776.
authorFlorian Krohm <florian@eich-krohm.de>
Mon, 11 Jul 2011 01:51:39 +0000 (01:51 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Mon, 11 Jul 2011 01:51:39 +0000 (01:51 +0000)
Add testcase for s390x's STFLE instruction.
Patch provided by Divya Vyas <divyvyas@linux.vnet.ibm.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11864

NEWS
none/tests/s390x/Makefile.am
none/tests/s390x/stfle.c [new file with mode: 0644]
none/tests/s390x/stfle.stderr.exp [new file with mode: 0644]
none/tests/s390x/stfle.stdout.exp [new file with mode: 0644]
none/tests/s390x/stfle.vgtest [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 5b758ac0a64e39866574b1aea18077a7fbee789c..8f027ef4ddba54ab3ce82c22c489af5f6d8d8244 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -262,6 +262,8 @@ fixed
 
 275710 - s390x: get rid of redundant address mode calculation
 
+271776 - s390x: Support STFLE instruction
+
 
 Release 3.6.1 (16 February 2011)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index a100e88676e5614baa9df09a979deb2efbc74cbb..2ead0a3a15aeb87ca8922684e7a8d4bb03d71b2f 100644 (file)
@@ -5,7 +5,7 @@ dist_noinst_SCRIPTS = filter_stderr
 INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \
              and or xor insert div srst fold_And16 flogr sub_EI add_EI \
              and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
-             op_exception fgx stck stckf stcke
+             op_exception fgx stck stckf stcke stfle
 
 check_PROGRAMS = $(INSN_TESTS) \
                 ex_sig \
diff --git a/none/tests/s390x/stfle.c b/none/tests/s390x/stfle.c
new file mode 100644 (file)
index 0000000..7bfe2d6
--- /dev/null
@@ -0,0 +1,56 @@
+#include <stdio.h>
+
+/* Number of double words needed to store all facility bits. */
+#define S390_NUM_FACILITY_DW 2
+
+
+unsigned long long stfle(unsigned long dw, unsigned bit_to_test)
+{
+  unsigned long long hoststfle[S390_NUM_FACILITY_DW], match;
+  register unsigned long long __nr asm("0") = dw - 1;
+  int cc;
+
+  asm volatile(" .insn s,0xb2b00000,%0 \n" /* stfle */
+               "ipm %2\n"
+               "srl %2,28\n"
+               : "=m" (*hoststfle), "+d" (__nr), "=d" (cc) : : "cc", "memory");
+
+  printf("the value of cc is %d and #double words is %llu\n", cc, __nr + 1);
+  if (bit_to_test < 64)
+    match = (hoststfle[0] & (1ULL << (63 - bit_to_test)));
+  else if (bit_to_test < 128)
+    match = (hoststfle[1] & (1ULL << (63 - bit_to_test)));
+  else
+    printf("code needs to be updated\n");
+
+  return match;
+}
+
+int main()
+{
+  int dw = S390_NUM_FACILITY_DW;
+
+  /* Test #1: Make sure STFLE returns sensible values. z/Arch facilities
+              must be present. */
+  if ((stfle(dw, 1)) && stfle(dw, 2))
+    printf("The z/Architecture architectural mode is installed and active\n");
+  else
+    printf("The z/Architecture architectural mode is not installed\n");
+
+  /* Test #2: Make sure the STFLE is supported. */
+  if (stfle(dw, 7))
+    printf("STFLE facility is installed\n");
+  else
+    printf("STFLE facility is not installed\n");
+
+  /* Test #3: Tell STFLE to only write 1 DW of facility bits. Expected condition
+              code should be 3 because this test is run on those machines only
+              that need 2 do double words to store facility bits. */
+  dw = 1;
+  if ((stfle(dw, 1)) && stfle(dw, 2))
+    printf("The z/Architecture architectural mode is installed and active\n");
+  else
+    printf("The z/Architecture architectural mode is not installed\n");
+
+  return 0;
+}
diff --git a/none/tests/s390x/stfle.stderr.exp b/none/tests/s390x/stfle.stderr.exp
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/stfle.stdout.exp b/none/tests/s390x/stfle.stdout.exp
new file mode 100644 (file)
index 0000000..c4653a9
--- /dev/null
@@ -0,0 +1,8 @@
+the value of cc is 0 and #double words is 2
+the value of cc is 0 and #double words is 2
+The z/Architecture architectural mode is installed and active
+the value of cc is 0 and #double words is 2
+STFLE facility is installed
+the value of cc is 3 and #double words is 2
+the value of cc is 3 and #double words is 2
+The z/Architecture architectural mode is installed and active
diff --git a/none/tests/s390x/stfle.vgtest b/none/tests/s390x/stfle.vgtest
new file mode 100644 (file)
index 0000000..76644b5
--- /dev/null
@@ -0,0 +1,2 @@
+prog:stfle
+prereq: ../../../tests/s390x_features s390x-stfle z196