Mark Wielaard 302637
valgrind svn commit r13494, VEX svn commit r2750
Mark Wielaard 302637
Mark Wielaard 302637
Initial ISA 2.07 support for POWER8-tuned libc
Mark Wielaard 302637
Mark Wielaard 302637
The IBM Power ISA 2.07 has been published on power.org, and IBM's new POWER8
Mark Wielaard 302637
processor is under development to implement that ISA. This patch provides
Mark Wielaard 302637
initial VEX support for running Valgrind on POWER8 systems running a soon-to-be
Mark Wielaard 302637
released Linux distribution. This Linux distro will include a POWER8-tuned
Mark Wielaard 302637
libc that uses a subset of the new instructions from ISA 2.07. Since virtually
Mark Wielaard 302637
all applications link with libc, it would be impossible to run an application
Mark Wielaard 302637
under Valgrind on this distro without adding support for these new instructions
Mark Wielaard 302637
to Valgrind, so that's the intent of this patch. Note that applications built
Mark Wielaard 302637
on this distro will *not* employ new POWER8 instructions by default. There are
Mark Wielaard 302637
roughly 150 new instructions in the Power ISA 2.07, including hardware
Mark Wielaard 302637
transaction management (HTM). Support for these new instructions (modulo the
Mark Wielaard 302637
subset included in this bug) will be added to Valgrind in a phased approach,
Mark Wielaard 302637
similar to what we did for Power ISA 2.06.
Mark Wielaard 302637
 
Mark Wielaard 302637
Bugzilla 322294
Mark Wielaard 302637
Mark Wielaard 302637
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/configure valgrind-3.8.1/configure
Mark Wielaard 302637
--- valgrind-3.8.1.orig/configure	2013-08-13 13:07:12.837887980 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/configure	2013-08-13 13:28:33.188030564 +0200
Mark Wielaard 302637
@@ -673,6 +673,8 @@
Mark Wielaard 302637
 FLAG_MMMX
Mark Wielaard 302637
 FLAG_M64
Mark Wielaard 302637
 FLAG_M32
Mark Wielaard 302637
+HAS_ISA_2_07_FALSE
Mark Wielaard 302637
+HAS_ISA_2_07_TRUE
Mark Wielaard 302637
 HAVE_PTHREAD_CREATE_GLIBC_2_0_FALSE
Mark Wielaard 302637
 HAVE_PTHREAD_CREATE_GLIBC_2_0_TRUE
Mark Wielaard 302637
 HAS_DFP_FALSE
Mark Wielaard 302637
@@ -7321,6 +7323,47 @@
Mark Wielaard 302637
 rm -f core conftest.err conftest.$ac_objext \
Mark Wielaard 302637
     conftest$ac_exeext conftest.$ac_ext
Mark Wielaard 302637
 
Mark Wielaard 302637
+# isa 2.07 checking
Mark Wielaard 302637
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that assembler knows ISA 2.07 " >&5
Mark Wielaard 302637
+$as_echo_n "checking that assembler knows ISA 2.07 ... " >&6; }
Mark Wielaard 302637
+
Mark Wielaard 302637
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Mark Wielaard 302637
+/* end confdefs.h.  */
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+int
Mark Wielaard 302637
+main ()
Mark Wielaard 302637
+{
Mark Wielaard 302637
+
Mark Wielaard 302637
+  __asm__ __volatile__("mtvsrd 1,2 ");
Mark Wielaard 302637
+
Mark Wielaard 302637
+  ;
Mark Wielaard 302637
+  return 0;
Mark Wielaard 302637
+}
Mark Wielaard 302637
+_ACEOF
Mark Wielaard 302637
+if ac_fn_c_try_compile "$LINENO"; then :
Mark Wielaard 302637
+
Mark Wielaard 302637
+ac_asm_have_isa_2_07=yes
Mark Wielaard 302637
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
Mark Wielaard 302637
+$as_echo "yes" >&6; }
Mark Wielaard 302637
+
Mark Wielaard 302637
+else
Mark Wielaard 302637
+
Mark Wielaard 302637
+ac_asm_have_isa_2_07=no
Mark Wielaard 302637
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
Mark Wielaard 302637
+$as_echo "no" >&6; }
Mark Wielaard 302637
+
Mark Wielaard 302637
+fi
Mark Wielaard 302637
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
Mark Wielaard 302637
+
Mark Wielaard 302637
+ if test x$ac_asm_have_isa_2_07 = xyes; then
Mark Wielaard 302637
+  HAS_ISA_2_07_TRUE=
Mark Wielaard 302637
+  HAS_ISA_2_07_FALSE='#'
Mark Wielaard 302637
+else
Mark Wielaard 302637
+  HAS_ISA_2_07_TRUE='#'
Mark Wielaard 302637
+  HAS_ISA_2_07_FALSE=
Mark Wielaard 302637
+fi
Mark Wielaard 302637
+
Mark Wielaard 302637
 
Mark Wielaard 302637
 #----------------------------------------------------------------------------
Mark Wielaard 302637
 # Checking for supported compiler flags.
Mark Wielaard 302637
@@ -10411,6 +10454,10 @@
Mark Wielaard 302637
   as_fn_error "conditional \"HAVE_PTHREAD_CREATE_GLIBC_2_0\" was never defined.
Mark Wielaard 302637
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
Mark Wielaard 302637
 fi
Mark Wielaard 302637
+if test -z "${HAS_ISA_2_07_TRUE}" && test -z "${HAS_ISA_2_07_FALSE}"; then
Mark Wielaard 302637
+  as_fn_error "conditional \"HAS_ISA_2_07\" was never defined.
Mark Wielaard 302637
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
Mark Wielaard 302637
+fi
Mark Wielaard 302637
 if test -z "${DWARF4_TRUE}" && test -z "${DWARF4_FALSE}"; then
Mark Wielaard 302637
   as_fn_error "conditional \"DWARF4\" was never defined.
Mark Wielaard 302637
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/configure.in valgrind-3.8.1/configure.in
Mark Wielaard 302637
--- valgrind-3.8.1.orig/configure.in	2013-08-13 13:07:12.800887713 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/configure.in	2013-08-13 13:10:17.485219043 +0200
Mark Wielaard 302637
@@ -1303,6 +1303,21 @@
Mark Wielaard 302637
 AC_MSG_RESULT([no])
Mark Wielaard 302637
 ])
Mark Wielaard 302637
 
Mark Wielaard 302637
+# isa 2.07 checking
Mark Wielaard 302637
+AC_MSG_CHECKING([that assembler knows ISA 2.07 ])
Mark Wielaard 302637
+
Mark Wielaard 302637
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Mark Wielaard 302637
+]], [[
Mark Wielaard 302637
+  __asm__ __volatile__("mtvsrd 1,2 ");
Mark Wielaard 302637
+]])], [
Mark Wielaard 302637
+ac_asm_have_isa_2_07=yes
Mark Wielaard 302637
+AC_MSG_RESULT([yes])
Mark Wielaard 302637
+], [
Mark Wielaard 302637
+ac_asm_have_isa_2_07=no
Mark Wielaard 302637
+AC_MSG_RESULT([no])
Mark Wielaard 302637
+])
Mark Wielaard 302637
+
Mark Wielaard 302637
+AM_CONDITIONAL(HAS_ISA_2_07, test x$ac_asm_have_isa_2_07 = xyes)
Mark Wielaard 302637
 
Mark Wielaard 302637
 #----------------------------------------------------------------------------
Mark Wielaard 302637
 # Checking for supported compiler flags.
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/coregrind/m_machine.c valgrind-3.8.1/coregrind/m_machine.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/coregrind/m_machine.c	2013-08-13 13:07:12.780887570 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/coregrind/m_machine.c	2013-08-13 13:10:17.487219057 +0200
Mark Wielaard 302637
@@ -862,6 +862,7 @@
Mark Wielaard 302637
      vki_sigaction_toK_t     tmp_sigill_act,   tmp_sigfpe_act;
Mark Wielaard 302637
 
Mark Wielaard 302637
      volatile Bool have_F, have_V, have_FX, have_GX, have_VX, have_DFP;
Mark Wielaard 302637
+     volatile Bool have_isa_2_07;
Mark Wielaard 302637
      Int r;
Mark Wielaard 302637
 
Mark Wielaard 302637
      /* This is a kludge.  Really we ought to back-convert saved_act
Mark Wielaard 302637
@@ -956,6 +957,14 @@
Mark Wielaard 302637
         __asm__ __volatile__(".long 0xee4e8005"); /* dadd  FRT,FRA, FRB */
Mark Wielaard 302637
      }
Mark Wielaard 302637
 
Mark Wielaard 302637
+     /* Check for ISA 2.07 support. */
Mark Wielaard 302637
+     have_isa_2_07 = True;
Mark Wielaard 302637
+     if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
Mark Wielaard 302637
+        have_isa_2_07 = False;
Mark Wielaard 302637
+     } else {
Mark Wielaard 302637
+        __asm__ __volatile__(".long 0x7c000166"); /* mtvsrd XT,RA */
Mark Wielaard 302637
+     }
Mark Wielaard 302637
+
Mark Wielaard 302637
      /* determine dcbz/dcbzl sizes while we still have the signal
Mark Wielaard 302637
       * handlers registered */
Mark Wielaard 302637
      find_ppc_dcbz_sz(&vai;;
Mark Wielaard 302637
@@ -966,9 +975,10 @@
Mark Wielaard 302637
      vg_assert(r == 0);
Mark Wielaard 302637
      r = VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
Mark Wielaard 302637
      vg_assert(r == 0);
Mark Wielaard 302637
-     VG_(debugLog)(1, "machine", "F %d V %d FX %d GX %d VX %d DFP %d\n",
Mark Wielaard 302637
+     VG_(debugLog)(1, "machine", "F %d V %d FX %d GX %d VX %d DFP %d ISA2.07 %d\n",
Mark Wielaard 302637
                     (Int)have_F, (Int)have_V, (Int)have_FX,
Mark Wielaard 302637
-                    (Int)have_GX, (Int)have_VX, (Int)have_DFP);
Mark Wielaard 302637
+                    (Int)have_GX, (Int)have_VX, (Int)have_DFP,
Mark Wielaard 302637
+                    (Int)have_isa_2_07);
Mark Wielaard 302637
      /* Make FP a prerequisite for VMX (bogusly so), and for FX and GX. */
Mark Wielaard 302637
      if (have_V && !have_F)
Mark Wielaard 302637
         have_V = False;
Mark Wielaard 302637
@@ -989,6 +999,7 @@
Mark Wielaard 302637
      if (have_GX) vai.hwcaps |= VEX_HWCAPS_PPC32_GX;
Mark Wielaard 302637
      if (have_VX) vai.hwcaps |= VEX_HWCAPS_PPC32_VX;
Mark Wielaard 302637
      if (have_DFP) vai.hwcaps |= VEX_HWCAPS_PPC32_DFP;
Mark Wielaard 302637
+     if (have_isa_2_07) vai.hwcaps |= VEX_HWCAPS_PPC32_ISA2_07;
Mark Wielaard 302637
 
Mark Wielaard 302637
 
Mark Wielaard 302637
      /* But we're not done yet: VG_(machine_ppc32_set_clszB) must be
Mark Wielaard 302637
@@ -1004,6 +1015,7 @@
Mark Wielaard 302637
      vki_sigaction_toK_t     tmp_sigill_act,   tmp_sigfpe_act;
Mark Wielaard 302637
 
Mark Wielaard 302637
      volatile Bool have_F, have_V, have_FX, have_GX, have_VX, have_DFP;
Mark Wielaard 302637
+     volatile Bool have_isa_2_07;
Mark Wielaard 302637
      Int r;
Mark Wielaard 302637
 
Mark Wielaard 302637
      /* This is a kludge.  Really we ought to back-convert saved_act
Mark Wielaard 302637
@@ -1090,6 +1102,14 @@
Mark Wielaard 302637
         __asm__ __volatile__(".long 0xee4e8005"); /* dadd  FRT,FRA, FRB */
Mark Wielaard 302637
      }
Mark Wielaard 302637
 
Mark Wielaard 302637
+     /* Check for ISA 2.07 support. */
Mark Wielaard 302637
+     have_isa_2_07 = True;
Mark Wielaard 302637
+     if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
Mark Wielaard 302637
+        have_isa_2_07 = False;
Mark Wielaard 302637
+     } else {
Mark Wielaard 302637
+        __asm__ __volatile__(".long 0x7c000166"); /* mtvsrd XT,RA */
Mark Wielaard 302637
+     }
Mark Wielaard 302637
+
Mark Wielaard 302637
      /* determine dcbz/dcbzl sizes while we still have the signal
Mark Wielaard 302637
       * handlers registered */
Mark Wielaard 302637
      find_ppc_dcbz_sz(&vai;;
Mark Wielaard 302637
@@ -1097,9 +1117,10 @@
Mark Wielaard 302637
      VG_(sigaction)(VKI_SIGILL, &saved_sigill_act, NULL);
Mark Wielaard 302637
      VG_(sigaction)(VKI_SIGFPE, &saved_sigfpe_act, NULL);
Mark Wielaard 302637
      VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
Mark Wielaard 302637
-     VG_(debugLog)(1, "machine", "F %d V %d FX %d GX %d VX %d DFP %d\n",
Mark Wielaard 302637
+     VG_(debugLog)(1, "machine", "F %d V %d FX %d GX %d VX %d DFP %d ISA2.07 %d\n",
Mark Wielaard 302637
                     (Int)have_F, (Int)have_V, (Int)have_FX,
Mark Wielaard 302637
-                    (Int)have_GX, (Int)have_VX, (Int)have_DFP);
Mark Wielaard 302637
+                    (Int)have_GX, (Int)have_VX, (Int)have_DFP,
Mark Wielaard 302637
+                    (Int)have_isa_2_07);
Mark Wielaard 302637
      /* on ppc64, if we don't even have FP, just give up. */
Mark Wielaard 302637
      if (!have_F)
Mark Wielaard 302637
         return False;
Mark Wielaard 302637
@@ -1114,6 +1135,7 @@
Mark Wielaard 302637
      if (have_GX) vai.hwcaps |= VEX_HWCAPS_PPC64_GX;
Mark Wielaard 302637
      if (have_VX) vai.hwcaps |= VEX_HWCAPS_PPC64_VX;
Mark Wielaard 302637
      if (have_DFP) vai.hwcaps |= VEX_HWCAPS_PPC64_DFP;
Mark Wielaard 302637
+     if (have_isa_2_07) vai.hwcaps |= VEX_HWCAPS_PPC64_ISA2_07;
Mark Wielaard 302637
 
Mark Wielaard 302637
      /* But we're not done yet: VG_(machine_ppc64_set_clszB) must be
Mark Wielaard 302637
         called before we're ready to go. */
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/memcheck/mc_translate.c valgrind-3.8.1/memcheck/mc_translate.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/memcheck/mc_translate.c	2013-08-13 13:07:12.733887229 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/memcheck/mc_translate.c	2013-08-13 13:10:17.490219078 +0200
Mark Wielaard 302637
@@ -3223,6 +3223,7 @@
Mark Wielaard 302637
          than a data steering operation. */
Mark Wielaard 302637
       case Iop_NarrowBin32to16x8: 
Mark Wielaard 302637
       case Iop_NarrowBin16to8x16: 
Mark Wielaard 302637
+      case Iop_NarrowBin64to32x4:
Mark Wielaard 302637
          return assignNew('V', mce, Ity_V128, 
Mark Wielaard 302637
                                     binop(op, vatom1, vatom2));
Mark Wielaard 302637
 
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/none/tests/ppc32/Makefile.am valgrind-3.8.1/none/tests/ppc32/Makefile.am
Mark Wielaard 302637
--- valgrind-3.8.1.orig/none/tests/ppc32/Makefile.am	2013-08-13 13:07:12.633886508 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/none/tests/ppc32/Makefile.am	2013-08-13 13:10:17.493219099 +0200
Mark Wielaard 302637
@@ -35,7 +35,10 @@
Mark Wielaard 302637
 	test_dfp2.stdout.exp_Without_dcffix \
Mark Wielaard 302637
 	test_dfp3.stderr.exp test_dfp3.stdout.exp test_dfp3.vgtest \
Mark Wielaard 302637
 	test_dfp4.stderr.exp test_dfp4.stdout.exp test_dfp4.vgtest \
Mark Wielaard 302637
-	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest
Mark Wielaard 302637
+	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest \
Mark Wielaard 302637
+	jm_vec_isa_2_07.stderr.exp jm_vec_isa_2_07.stdout.exp jm_vec_isa_2_07.vgtest \
Mark Wielaard 302637
+	test_isa_2_07_part2.stderr.exp test_isa_2_07_part2.stdout.exp test_isa_2_07_part2.vgtest
Mark Wielaard 302637
+
Mark Wielaard 302637
 
Mark Wielaard 302637
 check_PROGRAMS = \
Mark Wielaard 302637
 	allexec \
Mark Wielaard 302637
@@ -46,7 +49,9 @@
Mark Wielaard 302637
 	test_isa_2_06_part1 \
Mark Wielaard 302637
 	test_isa_2_06_part2 \
Mark Wielaard 302637
 	test_isa_2_06_part3 \
Mark Wielaard 302637
-	test_dfp1 test_dfp2 test_dfp3 test_dfp4 test_dfp5
Mark Wielaard 302637
+	test_dfp1 test_dfp2 test_dfp3 test_dfp4 test_dfp5 \
Mark Wielaard 302637
+	test_isa_2_07_part1 \
Mark Wielaard 302637
+	test_isa_2_07_part2
Mark Wielaard 302637
 
Mark Wielaard 302637
 
Mark Wielaard 302637
 AM_CFLAGS    += @FLAG_M32@
Mark Wielaard 302637
@@ -77,6 +82,14 @@
Mark Wielaard 302637
 DFP_FLAG =
Mark Wielaard 302637
 endif
Mark Wielaard 302637
 
Mark Wielaard 302637
+if HAS_ISA_2_07
Mark Wielaard 302637
+BUILD_FLAGS_ISA_2_07 = -mcpu=power8
Mark Wielaard 302637
+ISA_2_07_FLAG = -DHAS_ISA_2_07
Mark Wielaard 302637
+else
Mark Wielaard 302637
+BUILD_FLAGS_ISA_2_07 =
Mark Wielaard 302637
+ISA_2_07_FLAG =
Mark Wielaard 302637
+endif
Mark Wielaard 302637
+
Mark Wielaard 302637
 jm_insns_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames -maltivec \
Mark Wielaard 302637
 			@FLAG_M32@ $(ALTIVEC_FLAG)
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -104,3 +117,9 @@
Mark Wielaard 302637
 
Mark Wielaard 302637
 test_dfp5_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(DFP_FLAG) \
Mark Wielaard 302637
 			@FLAG_M32@ $(BUILD_FLAGS_DFP)
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+                        @FLAG_M32@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+			@FLAG_M64@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/none/tests/ppc32/Makefile.in valgrind-3.8.1/none/tests/ppc32/Makefile.in
Mark Wielaard 302637
--- valgrind-3.8.1.orig/none/tests/ppc32/Makefile.in	2013-08-13 13:07:12.632886501 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/none/tests/ppc32/Makefile.in	2013-08-13 13:28:32.372024756 +0200
Mark Wielaard 302637
@@ -63,7 +63,8 @@
Mark Wielaard 302637
 	test_isa_2_06_part1$(EXEEXT) test_isa_2_06_part2$(EXEEXT) \
Mark Wielaard 302637
 	test_isa_2_06_part3$(EXEEXT) test_dfp1$(EXEEXT) \
Mark Wielaard 302637
 	test_dfp2$(EXEEXT) test_dfp3$(EXEEXT) test_dfp4$(EXEEXT) \
Mark Wielaard 302637
-	test_dfp5$(EXEEXT)
Mark Wielaard 302637
+	test_dfp5$(EXEEXT) test_isa_2_07_part1$(EXEEXT) \
Mark Wielaard 302637
+	test_isa_2_07_part2$(EXEEXT)
Mark Wielaard 302637
 subdir = none/tests/ppc32
Mark Wielaard 302637
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Mark Wielaard 302637
 am__aclocal_m4_deps = $(top_srcdir)/configure.in
Mark Wielaard 302637
@@ -164,6 +165,18 @@
Mark Wielaard 302637
 test_isa_2_06_part3_LDADD = $(LDADD)
Mark Wielaard 302637
 test_isa_2_06_part3_LINK = $(CCLD) $(test_isa_2_06_part3_CFLAGS) \
Mark Wielaard 302637
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Mark Wielaard 302637
+test_isa_2_07_part1_SOURCES = test_isa_2_07_part1.c
Mark Wielaard 302637
+test_isa_2_07_part1_OBJECTS =  \
Mark Wielaard 302637
+	test_isa_2_07_part1-test_isa_2_07_part1.$(OBJEXT)
Mark Wielaard 302637
+test_isa_2_07_part1_LDADD = $(LDADD)
Mark Wielaard 302637
+test_isa_2_07_part1_LINK = $(CCLD) $(test_isa_2_07_part1_CFLAGS) \
Mark Wielaard 302637
+	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Mark Wielaard 302637
+test_isa_2_07_part2_SOURCES = test_isa_2_07_part2.c
Mark Wielaard 302637
+test_isa_2_07_part2_OBJECTS =  \
Mark Wielaard 302637
+	test_isa_2_07_part2-test_isa_2_07_part2.$(OBJEXT)
Mark Wielaard 302637
+test_isa_2_07_part2_LDADD = $(LDADD)
Mark Wielaard 302637
+test_isa_2_07_part2_LINK = $(CCLD) $(test_isa_2_07_part2_CFLAGS) \
Mark Wielaard 302637
+	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Mark Wielaard 302637
 tw_SOURCES = tw.c
Mark Wielaard 302637
 tw_OBJECTS = tw.$(OBJEXT)
Mark Wielaard 302637
 tw_LDADD = $(LDADD)
Mark Wielaard 302637
@@ -187,13 +200,15 @@
Mark Wielaard 302637
 	power6_bcmp.c round.c testVMX.c test_dfp1.c test_dfp2.c \
Mark Wielaard 302637
 	test_dfp3.c test_dfp4.c test_dfp5.c test_fx.c test_gx.c \
Mark Wielaard 302637
 	test_isa_2_06_part1.c test_isa_2_06_part2.c \
Mark Wielaard 302637
-	test_isa_2_06_part3.c tw.c twi.c xlc_dbl_u32.c
Mark Wielaard 302637
+	test_isa_2_06_part3.c test_isa_2_07_part1.c \
Mark Wielaard 302637
+	test_isa_2_07_part2.c tw.c twi.c xlc_dbl_u32.c
Mark Wielaard 302637
 DIST_SOURCES = allexec.c bug129390-ppc32.c bug139050-ppc32.c \
Mark Wielaard 302637
 	jm-insns.c ldstrev.c lsw.c mcrfs.c mftocrf.c power5+_round.c \
Mark Wielaard 302637
 	power6_bcmp.c round.c testVMX.c test_dfp1.c test_dfp2.c \
Mark Wielaard 302637
 	test_dfp3.c test_dfp4.c test_dfp5.c test_fx.c test_gx.c \
Mark Wielaard 302637
 	test_isa_2_06_part1.c test_isa_2_06_part2.c \
Mark Wielaard 302637
-	test_isa_2_06_part3.c tw.c twi.c xlc_dbl_u32.c
Mark Wielaard 302637
+	test_isa_2_06_part3.c test_isa_2_07_part1.c \
Mark Wielaard 302637
+	test_isa_2_07_part2.c tw.c twi.c xlc_dbl_u32.c
Mark Wielaard 302637
 ETAGS = etags
Mark Wielaard 302637
 CTAGS = ctags
Mark Wielaard 302637
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
Mark Wielaard 302637
@@ -507,7 +522,9 @@
Mark Wielaard 302637
 	test_dfp2.stdout.exp_Without_dcffix \
Mark Wielaard 302637
 	test_dfp3.stderr.exp test_dfp3.stdout.exp test_dfp3.vgtest \
Mark Wielaard 302637
 	test_dfp4.stderr.exp test_dfp4.stdout.exp test_dfp4.vgtest \
Mark Wielaard 302637
-	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest
Mark Wielaard 302637
+	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest \
Mark Wielaard 302637
+	jm_vec_isa_2_07.stderr.exp jm_vec_isa_2_07.stdout.exp jm_vec_isa_2_07.vgtest \
Mark Wielaard 302637
+	test_isa_2_07_part2.stderr.exp test_isa_2_07_part2.stdout.exp test_isa_2_07_part2.vgtest
Mark Wielaard 302637
 
Mark Wielaard 302637
 allexec_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@
Mark Wielaard 302637
 @HAS_ALTIVEC_FALSE@ALTIVEC_FLAG = 
Mark Wielaard 302637
@@ -520,6 +537,10 @@
Mark Wielaard 302637
 @HAS_DFP_TRUE@BUILD_FLAGS_DFP = -mhard-dfp -mcpu=power6
Mark Wielaard 302637
 @HAS_DFP_FALSE@DFP_FLAG = 
Mark Wielaard 302637
 @HAS_DFP_TRUE@DFP_FLAG = -DHAS_DFP
Mark Wielaard 302637
+@HAS_ISA_2_07_FALSE@BUILD_FLAGS_ISA_2_07 = 
Mark Wielaard 302637
+@HAS_ISA_2_07_TRUE@BUILD_FLAGS_ISA_2_07 = -mcpu=power8
Mark Wielaard 302637
+@HAS_ISA_2_07_FALSE@ISA_2_07_FLAG = 
Mark Wielaard 302637
+@HAS_ISA_2_07_TRUE@ISA_2_07_FLAG = -DHAS_ISA_2_07
Mark Wielaard 302637
 jm_insns_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames -maltivec \
Mark Wielaard 302637
 			@FLAG_M32@ $(ALTIVEC_FLAG)
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -550,6 +571,12 @@
Mark Wielaard 302637
 test_dfp5_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(DFP_FLAG) \
Mark Wielaard 302637
 			@FLAG_M32@ $(BUILD_FLAGS_DFP)
Mark Wielaard 302637
 
Mark Wielaard 302637
+test_isa_2_07_part1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+                        @FLAG_M32@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+			@FLAG_M64@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
+
Mark Wielaard 302637
 all: all-am
Mark Wielaard 302637
 
Mark Wielaard 302637
 .SUFFIXES:
Mark Wielaard 302637
@@ -653,6 +680,12 @@
Mark Wielaard 302637
 test_isa_2_06_part3$(EXEEXT): $(test_isa_2_06_part3_OBJECTS) $(test_isa_2_06_part3_DEPENDENCIES) 
Mark Wielaard 302637
 	@rm -f test_isa_2_06_part3$(EXEEXT)
Mark Wielaard 302637
 	$(test_isa_2_06_part3_LINK) $(test_isa_2_06_part3_OBJECTS) $(test_isa_2_06_part3_LDADD) $(LIBS)
Mark Wielaard 302637
+test_isa_2_07_part1$(EXEEXT): $(test_isa_2_07_part1_OBJECTS) $(test_isa_2_07_part1_DEPENDENCIES) 
Mark Wielaard 302637
+	@rm -f test_isa_2_07_part1$(EXEEXT)
Mark Wielaard 302637
+	$(test_isa_2_07_part1_LINK) $(test_isa_2_07_part1_OBJECTS) $(test_isa_2_07_part1_LDADD) $(LIBS)
Mark Wielaard 302637
+test_isa_2_07_part2$(EXEEXT): $(test_isa_2_07_part2_OBJECTS) $(test_isa_2_07_part2_DEPENDENCIES) 
Mark Wielaard 302637
+	@rm -f test_isa_2_07_part2$(EXEEXT)
Mark Wielaard 302637
+	$(test_isa_2_07_part2_LINK) $(test_isa_2_07_part2_OBJECTS) $(test_isa_2_07_part2_LDADD) $(LIBS)
Mark Wielaard 302637
 tw$(EXEEXT): $(tw_OBJECTS) $(tw_DEPENDENCIES) 
Mark Wielaard 302637
 	@rm -f tw$(EXEEXT)
Mark Wielaard 302637
 	$(LINK) $(tw_OBJECTS) $(tw_LDADD) $(LIBS)
Mark Wielaard 302637
@@ -691,6 +724,8 @@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_06_part1-test_isa_2_06_part1.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_06_part2-test_isa_2_06_part2.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_06_part3-test_isa_2_06_part3.Po@am__quote@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Po@am__quote@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tw.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/twi.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlc_dbl_u32.Po@am__quote@
Mark Wielaard 302637
@@ -863,6 +898,34 @@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_06_part3_CFLAGS) $(CFLAGS) -c -o test_isa_2_06_part3-test_isa_2_06_part3.obj `if test -f 'test_isa_2_06_part3.c'; then $(CYGPATH_W) 'test_isa_2_06_part3.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_06_part3.c'; fi`
Mark Wielaard 302637
 
Mark Wielaard 302637
+test_isa_2_07_part1-test_isa_2_07_part1.o: test_isa_2_07_part1.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part1-test_isa_2_07_part1.o -MD -MP -MF $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo -c -o test_isa_2_07_part1-test_isa_2_07_part1.o `test -f 'test_isa_2_07_part1.c' || echo '$(srcdir)/'`test_isa_2_07_part1.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part1.c' object='test_isa_2_07_part1-test_isa_2_07_part1.o' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part1-test_isa_2_07_part1.o `test -f 'test_isa_2_07_part1.c' || echo '$(srcdir)/'`test_isa_2_07_part1.c
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part1-test_isa_2_07_part1.obj: test_isa_2_07_part1.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part1-test_isa_2_07_part1.obj -MD -MP -MF $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo -c -o test_isa_2_07_part1-test_isa_2_07_part1.obj `if test -f 'test_isa_2_07_part1.c'; then $(CYGPATH_W) 'test_isa_2_07_part1.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part1.c'; fi`
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part1.c' object='test_isa_2_07_part1-test_isa_2_07_part1.obj' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part1-test_isa_2_07_part1.obj `if test -f 'test_isa_2_07_part1.c'; then $(CYGPATH_W) 'test_isa_2_07_part1.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part1.c'; fi`
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2-test_isa_2_07_part2.o: test_isa_2_07_part2.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part2-test_isa_2_07_part2.o -MD -MP -MF $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo -c -o test_isa_2_07_part2-test_isa_2_07_part2.o `test -f 'test_isa_2_07_part2.c' || echo '$(srcdir)/'`test_isa_2_07_part2.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part2.c' object='test_isa_2_07_part2-test_isa_2_07_part2.o' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part2-test_isa_2_07_part2.o `test -f 'test_isa_2_07_part2.c' || echo '$(srcdir)/'`test_isa_2_07_part2.c
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2-test_isa_2_07_part2.obj: test_isa_2_07_part2.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part2-test_isa_2_07_part2.obj -MD -MP -MF $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo -c -o test_isa_2_07_part2-test_isa_2_07_part2.obj `if test -f 'test_isa_2_07_part2.c'; then $(CYGPATH_W) 'test_isa_2_07_part2.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part2.c'; fi`
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part2.c' object='test_isa_2_07_part2-test_isa_2_07_part2.obj' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part2-test_isa_2_07_part2.obj `if test -f 'test_isa_2_07_part2.c'; then $(CYGPATH_W) 'test_isa_2_07_part2.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part2.c'; fi`
Mark Wielaard 302637
+
Mark Wielaard 302637
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
Mark Wielaard 302637
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
Mark Wielaard 302637
 	unique=`for i in $$list; do \
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/none/tests/ppc64/Makefile.am valgrind-3.8.1/none/tests/ppc64/Makefile.am
Mark Wielaard 302637
--- valgrind-3.8.1.orig/none/tests/ppc64/Makefile.am	2013-08-13 13:07:12.675886811 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/none/tests/ppc64/Makefile.am	2013-08-13 13:10:17.496219122 +0200
Mark Wielaard 302637
@@ -23,12 +23,16 @@
Mark Wielaard 302637
 	test_dfp2.stdout.exp_Without_dcffix \
Mark Wielaard 302637
 	test_dfp3.stderr.exp test_dfp3.stdout.exp test_dfp3.vgtest \
Mark Wielaard 302637
 	test_dfp4.stderr.exp test_dfp4.stdout.exp test_dfp4.vgtest \
Mark Wielaard 302637
-	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest
Mark Wielaard 302637
+	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest \
Mark Wielaard 302637
+	jm_vec_isa_2_07.stderr.exp jm_vec_isa_2_07.stdout.exp jm_vec_isa_2_07.vgtest \
Mark Wielaard 302637
+	test_isa_2_07_part2.stderr.exp test_isa_2_07_part2.stdout.exp test_isa_2_07_part2.vgtest
Mark Wielaard 302637
 
Mark Wielaard 302637
 check_PROGRAMS = \
Mark Wielaard 302637
 	allexec \
Mark Wielaard 302637
-	jm-insns lsw round std_reg_imm twi_tdi tw_td power6_bcmp power6_mf_gpr test_isa_2_06_part1 \
Mark Wielaard 302637
-	test_isa_2_06_part2 test_isa_2_06_part3 test_dfp1 test_dfp2 test_dfp3 test_dfp4 test_dfp5
Mark Wielaard 302637
+	jm-insns lsw round std_reg_imm twi_tdi tw_td power6_bcmp \
Mark Wielaard 302637
+	power6_mf_gpr test_isa_2_06_part1 test_isa_2_06_part2 \
Mark Wielaard 302637
+	test_isa_2_06_part3 test_dfp1 test_dfp2 test_dfp3 test_dfp4 \
Mark Wielaard 302637
+	test_dfp5 test_isa_2_07_part1 test_isa_2_07_part2
Mark Wielaard 302637
 
Mark Wielaard 302637
 AM_CFLAGS    += @FLAG_M64@
Mark Wielaard 302637
 AM_CXXFLAGS  += @FLAG_M64@
Mark Wielaard 302637
@@ -58,6 +62,14 @@
Mark Wielaard 302637
 DFP_FLAG =
Mark Wielaard 302637
 endif
Mark Wielaard 302637
 
Mark Wielaard 302637
+if HAS_ISA_2_07
Mark Wielaard 302637
+BUILD_FLAGS_ISA_2_07 = -mcpu=power8
Mark Wielaard 302637
+ISA_2_07_FLAG = -DHAS_ISA_2_07
Mark Wielaard 302637
+else
Mark Wielaard 302637
+BUILD_FLAGS_ISA_2_07 =
Mark Wielaard 302637
+ISA_2_07_FLAG =
Mark Wielaard 302637
+endif
Mark Wielaard 302637
+
Mark Wielaard 302637
 test_isa_2_06_part1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_FLAG) \
Mark Wielaard 302637
 			@FLAG_M64@ $(ALTIVEC_FLAG) $(BUILD_FLAG_VSX)
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -84,3 +96,8 @@
Mark Wielaard 302637
 test_dfp5_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(DFP_FLAG) \
Mark Wielaard 302637
 			@FLAG_M64@ $(BUILD_FLAGS_DFP)
Mark Wielaard 302637
 
Mark Wielaard 302637
+test_isa_2_07_part1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+			@FLAG_M64@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+			@FLAG_M64@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/none/tests/ppc64/Makefile.in valgrind-3.8.1/none/tests/ppc64/Makefile.in
Mark Wielaard 302637
--- valgrind-3.8.1.orig/none/tests/ppc64/Makefile.in	2013-08-13 13:07:12.674886804 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/none/tests/ppc64/Makefile.in	2013-08-13 13:28:32.460025381 +0200
Mark Wielaard 302637
@@ -60,7 +60,8 @@
Mark Wielaard 302637
 	test_isa_2_06_part1$(EXEEXT) test_isa_2_06_part2$(EXEEXT) \
Mark Wielaard 302637
 	test_isa_2_06_part3$(EXEEXT) test_dfp1$(EXEEXT) \
Mark Wielaard 302637
 	test_dfp2$(EXEEXT) test_dfp3$(EXEEXT) test_dfp4$(EXEEXT) \
Mark Wielaard 302637
-	test_dfp5$(EXEEXT)
Mark Wielaard 302637
+	test_dfp5$(EXEEXT) test_isa_2_07_part1$(EXEEXT) \
Mark Wielaard 302637
+	test_isa_2_07_part2$(EXEEXT)
Mark Wielaard 302637
 subdir = none/tests/ppc64
Mark Wielaard 302637
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Mark Wielaard 302637
 am__aclocal_m4_deps = $(top_srcdir)/configure.in
Mark Wielaard 302637
@@ -138,6 +139,18 @@
Mark Wielaard 302637
 test_isa_2_06_part3_LDADD = $(LDADD)
Mark Wielaard 302637
 test_isa_2_06_part3_LINK = $(CCLD) $(test_isa_2_06_part3_CFLAGS) \
Mark Wielaard 302637
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Mark Wielaard 302637
+test_isa_2_07_part1_SOURCES = test_isa_2_07_part1.c
Mark Wielaard 302637
+test_isa_2_07_part1_OBJECTS =  \
Mark Wielaard 302637
+	test_isa_2_07_part1-test_isa_2_07_part1.$(OBJEXT)
Mark Wielaard 302637
+test_isa_2_07_part1_LDADD = $(LDADD)
Mark Wielaard 302637
+test_isa_2_07_part1_LINK = $(CCLD) $(test_isa_2_07_part1_CFLAGS) \
Mark Wielaard 302637
+	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Mark Wielaard 302637
+test_isa_2_07_part2_SOURCES = test_isa_2_07_part2.c
Mark Wielaard 302637
+test_isa_2_07_part2_OBJECTS =  \
Mark Wielaard 302637
+	test_isa_2_07_part2-test_isa_2_07_part2.$(OBJEXT)
Mark Wielaard 302637
+test_isa_2_07_part2_LDADD = $(LDADD)
Mark Wielaard 302637
+test_isa_2_07_part2_LINK = $(CCLD) $(test_isa_2_07_part2_CFLAGS) \
Mark Wielaard 302637
+	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Mark Wielaard 302637
 tw_td_SOURCES = tw_td.c
Mark Wielaard 302637
 tw_td_OBJECTS = tw_td.$(OBJEXT)
Mark Wielaard 302637
 tw_td_LDADD = $(LDADD)
Mark Wielaard 302637
@@ -156,11 +169,13 @@
Mark Wielaard 302637
 SOURCES = allexec.c jm-insns.c lsw.c power6_bcmp.c power6_mf_gpr.c \
Mark Wielaard 302637
 	round.c std_reg_imm.c test_dfp1.c test_dfp2.c test_dfp3.c \
Mark Wielaard 302637
 	test_dfp4.c test_dfp5.c test_isa_2_06_part1.c \
Mark Wielaard 302637
-	test_isa_2_06_part2.c test_isa_2_06_part3.c tw_td.c twi_tdi.c
Mark Wielaard 302637
+	test_isa_2_06_part2.c test_isa_2_06_part3.c \
Mark Wielaard 302637
+	test_isa_2_07_part1.c test_isa_2_07_part2.c tw_td.c twi_tdi.c
Mark Wielaard 302637
 DIST_SOURCES = allexec.c jm-insns.c lsw.c power6_bcmp.c \
Mark Wielaard 302637
 	power6_mf_gpr.c round.c std_reg_imm.c test_dfp1.c test_dfp2.c \
Mark Wielaard 302637
 	test_dfp3.c test_dfp4.c test_dfp5.c test_isa_2_06_part1.c \
Mark Wielaard 302637
-	test_isa_2_06_part2.c test_isa_2_06_part3.c tw_td.c twi_tdi.c
Mark Wielaard 302637
+	test_isa_2_06_part2.c test_isa_2_06_part3.c \
Mark Wielaard 302637
+	test_isa_2_07_part1.c test_isa_2_07_part2.c tw_td.c twi_tdi.c
Mark Wielaard 302637
 ETAGS = etags
Mark Wielaard 302637
 CTAGS = ctags
Mark Wielaard 302637
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
Mark Wielaard 302637
@@ -462,7 +477,9 @@
Mark Wielaard 302637
 	test_dfp2.stdout.exp_Without_dcffix \
Mark Wielaard 302637
 	test_dfp3.stderr.exp test_dfp3.stdout.exp test_dfp3.vgtest \
Mark Wielaard 302637
 	test_dfp4.stderr.exp test_dfp4.stdout.exp test_dfp4.vgtest \
Mark Wielaard 302637
-	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest
Mark Wielaard 302637
+	test_dfp5.stderr.exp test_dfp5.stdout.exp test_dfp5.vgtest \
Mark Wielaard 302637
+	jm_vec_isa_2_07.stderr.exp jm_vec_isa_2_07.stdout.exp jm_vec_isa_2_07.vgtest \
Mark Wielaard 302637
+	test_isa_2_07_part2.stderr.exp test_isa_2_07_part2.stdout.exp test_isa_2_07_part2.vgtest
Mark Wielaard 302637
 
Mark Wielaard 302637
 allexec_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@
Mark Wielaard 302637
 @HAS_ALTIVEC_FALSE@ALTIVEC_FLAG = 
Mark Wielaard 302637
@@ -475,6 +492,10 @@
Mark Wielaard 302637
 @HAS_DFP_TRUE@BUILD_FLAGS_DFP = -mhard-dfp -mcpu=power6
Mark Wielaard 302637
 @HAS_DFP_FALSE@DFP_FLAG = 
Mark Wielaard 302637
 @HAS_DFP_TRUE@DFP_FLAG = -DHAS_DFP
Mark Wielaard 302637
+@HAS_ISA_2_07_FALSE@BUILD_FLAGS_ISA_2_07 = 
Mark Wielaard 302637
+@HAS_ISA_2_07_TRUE@BUILD_FLAGS_ISA_2_07 = -mcpu=power8
Mark Wielaard 302637
+@HAS_ISA_2_07_FALSE@ISA_2_07_FLAG = 
Mark Wielaard 302637
+@HAS_ISA_2_07_TRUE@ISA_2_07_FLAG = -DHAS_ISA_2_07
Mark Wielaard 302637
 test_isa_2_06_part1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_FLAG) \
Mark Wielaard 302637
 			@FLAG_M64@ $(ALTIVEC_FLAG) $(BUILD_FLAG_VSX)
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -502,6 +523,12 @@
Mark Wielaard 302637
 test_dfp5_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(DFP_FLAG) \
Mark Wielaard 302637
 			@FLAG_M64@ $(BUILD_FLAGS_DFP)
Mark Wielaard 302637
 
Mark Wielaard 302637
+test_isa_2_07_part1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+			@FLAG_M64@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \
Mark Wielaard 302637
+			@FLAG_M64@ $(BUILD_FLAGS_ISA_2_07)
Mark Wielaard 302637
+
Mark Wielaard 302637
 all: all-am
Mark Wielaard 302637
 
Mark Wielaard 302637
 .SUFFIXES:
Mark Wielaard 302637
@@ -584,6 +611,12 @@
Mark Wielaard 302637
 test_isa_2_06_part3$(EXEEXT): $(test_isa_2_06_part3_OBJECTS) $(test_isa_2_06_part3_DEPENDENCIES) 
Mark Wielaard 302637
 	@rm -f test_isa_2_06_part3$(EXEEXT)
Mark Wielaard 302637
 	$(test_isa_2_06_part3_LINK) $(test_isa_2_06_part3_OBJECTS) $(test_isa_2_06_part3_LDADD) $(LIBS)
Mark Wielaard 302637
+test_isa_2_07_part1$(EXEEXT): $(test_isa_2_07_part1_OBJECTS) $(test_isa_2_07_part1_DEPENDENCIES) 
Mark Wielaard 302637
+	@rm -f test_isa_2_07_part1$(EXEEXT)
Mark Wielaard 302637
+	$(test_isa_2_07_part1_LINK) $(test_isa_2_07_part1_OBJECTS) $(test_isa_2_07_part1_LDADD) $(LIBS)
Mark Wielaard 302637
+test_isa_2_07_part2$(EXEEXT): $(test_isa_2_07_part2_OBJECTS) $(test_isa_2_07_part2_DEPENDENCIES) 
Mark Wielaard 302637
+	@rm -f test_isa_2_07_part2$(EXEEXT)
Mark Wielaard 302637
+	$(test_isa_2_07_part2_LINK) $(test_isa_2_07_part2_OBJECTS) $(test_isa_2_07_part2_LDADD) $(LIBS)
Mark Wielaard 302637
 tw_td$(EXEEXT): $(tw_td_OBJECTS) $(tw_td_DEPENDENCIES) 
Mark Wielaard 302637
 	@rm -f tw_td$(EXEEXT)
Mark Wielaard 302637
 	$(LINK) $(tw_td_OBJECTS) $(tw_td_LDADD) $(LIBS)
Mark Wielaard 302637
@@ -612,6 +645,8 @@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_06_part1-test_isa_2_06_part1.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_06_part2-test_isa_2_06_part2.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_06_part3-test_isa_2_06_part3.Po@am__quote@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Po@am__quote@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tw_td.Po@am__quote@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/twi_tdi.Po@am__quote@
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -769,6 +804,34 @@
Mark Wielaard 302637
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_06_part3_CFLAGS) $(CFLAGS) -c -o test_isa_2_06_part3-test_isa_2_06_part3.obj `if test -f 'test_isa_2_06_part3.c'; then $(CYGPATH_W) 'test_isa_2_06_part3.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_06_part3.c'; fi`
Mark Wielaard 302637
 
Mark Wielaard 302637
+test_isa_2_07_part1-test_isa_2_07_part1.o: test_isa_2_07_part1.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part1-test_isa_2_07_part1.o -MD -MP -MF $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo -c -o test_isa_2_07_part1-test_isa_2_07_part1.o `test -f 'test_isa_2_07_part1.c' || echo '$(srcdir)/'`test_isa_2_07_part1.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part1.c' object='test_isa_2_07_part1-test_isa_2_07_part1.o' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part1-test_isa_2_07_part1.o `test -f 'test_isa_2_07_part1.c' || echo '$(srcdir)/'`test_isa_2_07_part1.c
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part1-test_isa_2_07_part1.obj: test_isa_2_07_part1.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part1-test_isa_2_07_part1.obj -MD -MP -MF $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo -c -o test_isa_2_07_part1-test_isa_2_07_part1.obj `if test -f 'test_isa_2_07_part1.c'; then $(CYGPATH_W) 'test_isa_2_07_part1.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part1.c'; fi`
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Tpo $(DEPDIR)/test_isa_2_07_part1-test_isa_2_07_part1.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part1.c' object='test_isa_2_07_part1-test_isa_2_07_part1.obj' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part1_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part1-test_isa_2_07_part1.obj `if test -f 'test_isa_2_07_part1.c'; then $(CYGPATH_W) 'test_isa_2_07_part1.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part1.c'; fi`
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2-test_isa_2_07_part2.o: test_isa_2_07_part2.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part2-test_isa_2_07_part2.o -MD -MP -MF $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo -c -o test_isa_2_07_part2-test_isa_2_07_part2.o `test -f 'test_isa_2_07_part2.c' || echo '$(srcdir)/'`test_isa_2_07_part2.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part2.c' object='test_isa_2_07_part2-test_isa_2_07_part2.o' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part2-test_isa_2_07_part2.o `test -f 'test_isa_2_07_part2.c' || echo '$(srcdir)/'`test_isa_2_07_part2.c
Mark Wielaard 302637
+
Mark Wielaard 302637
+test_isa_2_07_part2-test_isa_2_07_part2.obj: test_isa_2_07_part2.c
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -MT test_isa_2_07_part2-test_isa_2_07_part2.obj -MD -MP -MF $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo -c -o test_isa_2_07_part2-test_isa_2_07_part2.obj `if test -f 'test_isa_2_07_part2.c'; then $(CYGPATH_W) 'test_isa_2_07_part2.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part2.c'; fi`
Mark Wielaard 302637
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Tpo $(DEPDIR)/test_isa_2_07_part2-test_isa_2_07_part2.Po
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='test_isa_2_07_part2.c' object='test_isa_2_07_part2-test_isa_2_07_part2.obj' libtool=no @AMDEPBACKSLASH@
Mark Wielaard 302637
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
Mark Wielaard 302637
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_isa_2_07_part2_CFLAGS) $(CFLAGS) -c -o test_isa_2_07_part2-test_isa_2_07_part2.obj `if test -f 'test_isa_2_07_part2.c'; then $(CYGPATH_W) 'test_isa_2_07_part2.c'; else $(CYGPATH_W) '$(srcdir)/test_isa_2_07_part2.c'; fi`
Mark Wielaard 302637
+
Mark Wielaard 302637
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
Mark Wielaard 302637
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
Mark Wielaard 302637
 	unique=`for i in $$list; do \
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/tests/check_isa-2_06_cap valgrind-3.8.1/tests/check_isa-2_06_cap
Mark Wielaard 302637
--- valgrind-3.8.1.orig/tests/check_isa-2_06_cap	2013-08-13 13:07:12.820887858 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/tests/check_isa-2_06_cap	2013-08-13 13:10:17.500219150 +0200
Mark Wielaard 302637
@@ -1,8 +1,9 @@
Mark Wielaard 302637
 #!/bin/sh
Mark Wielaard 302637
 
Mark Wielaard 302637
-# We use this script to check whether or not the processor supports Power ISA 2.06.
Mark Wielaard 302637
+# We use this script to check whether or not the processor supports Power ISA 2.06 or later.
Mark Wielaard 302637
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Mark Wielaard 302637
+LD_SHOW_AUXV=1 $DIR/true | grep  arch_2_06 > /dev/null 2>&1
Mark Wielaard 302637
 
Mark Wielaard 302637
-LD_SHOW_AUXV=1 /bin/true | grep  arch_2_06 > /dev/null 2>&1
Mark Wielaard 302637
 if [ "$?" -ne "0" ]; then
Mark Wielaard 302637
 	exit 1
Mark Wielaard 302637
 else
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/priv/guest_ppc_toIR.c valgrind-3.8.1/VEX/priv/guest_ppc_toIR.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/priv/guest_ppc_toIR.c	2013-08-13 13:07:12.730887208 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/priv/guest_ppc_toIR.c	2013-08-13 13:10:17.465218898 +0200
Mark Wielaard 302637
@@ -4918,11 +4918,17 @@
Mark Wielaard 302637
    case 0x3E:
Mark Wielaard 302637
       switch ((b1<<1) | b0) {
Mark Wielaard 302637
       case 0x0: // std (Store DWord, PPC64 p580)
Mark Wielaard 302637
+         if (!mode64)
Mark Wielaard 302637
+            return False;
Mark Wielaard 302637
+
Mark Wielaard 302637
          DIP("std r%u,%d(r%u)\n", rS_addr, simm16, rA_addr);
Mark Wielaard 302637
          storeBE( mkexpr(EA), mkexpr(rS) );
Mark Wielaard 302637
          break;
Mark Wielaard 302637
 
Mark Wielaard 302637
       case 0x1: // stdu (Store DWord, Update, PPC64 p583)
Mark Wielaard 302637
+         if (!mode64)
Mark Wielaard 302637
+            return False;
Mark Wielaard 302637
+
Mark Wielaard 302637
          DIP("stdu r%u,%d(r%u)\n", rS_addr, simm16, rA_addr);
Mark Wielaard 302637
          putIReg( rA_addr, mkexpr(EA) );
Mark Wielaard 302637
          storeBE( mkexpr(EA), mkexpr(rS) );
Mark Wielaard 302637
@@ -6452,7 +6458,7 @@
Mark Wielaard 302637
       }
Mark Wielaard 302637
       /* not decodable */
Mark Wielaard 302637
       return False;
Mark Wielaard 302637
-    
Mark Wielaard 302637
+
Mark Wielaard 302637
    /* XFX-Form */
Mark Wielaard 302637
    case 0x153: // mfspr (Move from Special-Purpose Register, PPC32 p470)
Mark Wielaard 302637
       
Mark Wielaard 302637
@@ -6620,7 +6626,79 @@
Mark Wielaard 302637
          return False;
Mark Wielaard 302637
       }
Mark Wielaard 302637
       break;
Mark Wielaard 302637
-      
Mark Wielaard 302637
+
Mark Wielaard 302637
+   case 0x33:                // mfvsrd
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+      UChar XS = ifieldRegXS( theInstr );
Mark Wielaard 302637
+      UChar rA_addr = ifieldRegA(theInstr);
Mark Wielaard 302637
+      IRExpr * high64;
Mark Wielaard 302637
+      IRTemp vS = newTemp( Ity_V128 );
Mark Wielaard 302637
+      DIP("mfvsrd r%u,vsr%d\n", rA_addr, (UInt)XS);
Mark Wielaard 302637
+
Mark Wielaard 302637
+      /*  XS = SX || S
Mark Wielaard 302637
+       *  For SX=0, mfvsrd is treated as a Floating-Point
Mark Wielaard 302637
+       *            instruction in terms of resource availability.
Mark Wielaard 302637
+       *  For SX=1, mfvsrd is treated as a Vector instruction in
Mark Wielaard 302637
+       *            terms of resource availability.
Mark Wielaard 302637
+       *NEED TO FIGURE OUT HOW TO IMPLEMENT THE RESOURCE AVAILABILITY PART
Mark Wielaard 302637
+       */
Mark Wielaard 302637
+      assign( vS, getVSReg( XS ) );
Mark Wielaard 302637
+      high64 = unop( Iop_V128HIto64, mkexpr( vS ) );
Mark Wielaard 302637
+      putIReg( rA_addr, (mode64) ? high64 :
Mark Wielaard 302637
+      unop( Iop_64to32, high64 ) );
Mark Wielaard 302637
+      break;
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+
Mark Wielaard 302637
+   case 0xB3:                // mtvsrd
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+      UChar XT = ifieldRegXT( theInstr );
Mark Wielaard 302637
+      UChar rA_addr = ifieldRegA(theInstr);
Mark Wielaard 302637
+      IRTemp rA = newTemp(ty);
Mark Wielaard 302637
+      DIP("mtvsrd vsr%d,r%u\n", (UInt)XT, rA_addr);
Mark Wielaard 302637
+      /*  XS = SX || S
Mark Wielaard 302637
+       *  For SX=0, mfvsrd is treated as a Floating-Point
Mark Wielaard 302637
+       *            instruction in terms of resource availability.
Mark Wielaard 302637
+       *  For SX=1, mfvsrd is treated as a Vector instruction in
Mark Wielaard 302637
+       *            terms of resource availability.
Mark Wielaard 302637
+       *NEED TO FIGURE OUT HOW TO IMPLEMENT THE RESOURCE AVAILABILITY PART
Mark Wielaard 302637
+       */
Mark Wielaard 302637
+      assign( rA, getIReg(rA_addr) );
Mark Wielaard 302637
+
Mark Wielaard 302637
+      if (mode64)
Mark Wielaard 302637
+         putVSReg( XT, binop( Iop_64HLtoV128, mkexpr( rA ), mkU64( 0 ) ) );
Mark Wielaard 302637
+      else
Mark Wielaard 302637
+         putVSReg( XT, binop( Iop_64HLtoV128,
Mark Wielaard 302637
+                              binop( Iop_32HLto64,
Mark Wielaard 302637
+                                     mkU32( 0 ),
Mark Wielaard 302637
+                                     mkexpr( rA ) ),
Mark Wielaard 302637
+                                     mkU64( 0 ) ) );
Mark Wielaard 302637
+      break;
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+
Mark Wielaard 302637
+   case 0xD3:                // mtvsrwa
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+      UChar XT = ifieldRegXT( theInstr );
Mark Wielaard 302637
+      UChar rA_addr = ifieldRegA(theInstr);
Mark Wielaard 302637
+      IRTemp rA = newTemp( Ity_I32 );
Mark Wielaard 302637
+      DIP("mtvsrwa vsr%d,r%u\n", (UInt)XT, rA_addr);
Mark Wielaard 302637
+      /*  XS = SX || S
Mark Wielaard 302637
+       *  For SX=0, mtvsrwa is treated as a Floating-Point
Mark Wielaard 302637
+       *            instruction in terms of resource availability.
Mark Wielaard 302637
+       *  For SX=1, mtvsrwa is treated as a Vector instruction in
Mark Wielaard 302637
+       *            terms of resource availability.
Mark Wielaard 302637
+       *NEED TO FIGURE OUT HOW TO IMPLEMENT THE RESOURCE AVAILABILITY PART
Mark Wielaard 302637
+       */
Mark Wielaard 302637
+      if (mode64)
Mark Wielaard 302637
+         assign( rA, unop( Iop_64to32, getIReg( rA_addr ) ) );
Mark Wielaard 302637
+      else
Mark Wielaard 302637
+         assign( rA, getIReg(rA_addr) );
Mark Wielaard 302637
+
Mark Wielaard 302637
+      putVSReg( XT, binop( Iop_64HLtoV128,
Mark Wielaard 302637
+                           unop( Iop_32Sto64, mkexpr( rA ) ),
Mark Wielaard 302637
+                           mkU64( 0 ) ) );
Mark Wielaard 302637
+      break;
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+
Mark Wielaard 302637
    default:
Mark Wielaard 302637
       vex_printf("dis_proc_ctl(ppc)(opc2)\n");
Mark Wielaard 302637
       return False;
Mark Wielaard 302637
@@ -11635,7 +11713,7 @@
Mark Wielaard 302637
    /* Create and assign temps only as needed for the given instruction. */
Mark Wielaard 302637
    switch (opc2) {
Mark Wielaard 302637
       // scalar double-precision floating point argument
Mark Wielaard 302637
-      case 0x2B0: case 0x0b0: case 0x290: case 0x212: case 0x090:
Mark Wielaard 302637
+      case 0x2B0: case 0x0b0: case 0x290: case 0x212: case 0x216: case 0x090:
Mark Wielaard 302637
          xB = newTemp(Ity_F64);
Mark Wielaard 302637
          assign( xB,
Mark Wielaard 302637
                  unop( Iop_ReinterpI64asF64,
Mark Wielaard 302637
@@ -11677,6 +11755,11 @@
Mark Wielaard 302637
          assign( xB,
Mark Wielaard 302637
                  unop( Iop_64HIto32, unop( Iop_V128HIto64, getVSReg( XB ) ) ) );
Mark Wielaard 302637
          break;
Mark Wielaard 302637
+      case 0x296: // xscvspdpn (non signaling version of xscvpdp)
Mark Wielaard 302637
+         xB = newTemp(Ity_I32);
Mark Wielaard 302637
+         assign( xB,
Mark Wielaard 302637
+                 unop( Iop_64HIto32, unop( Iop_V128HIto64, getVSReg( XB ) ) ) );
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
 
Mark Wielaard 302637
       /* Certain instructions have their complete implementation in the main switch statement
Mark Wielaard 302637
        * that follows this one; thus we have a "do nothing" case for those instructions here.
Mark Wielaard 302637
@@ -11824,6 +11907,18 @@
Mark Wielaard 302637
                                  mkU32( 0 ) ),
Mark Wielaard 302637
                           mkU64( 0ULL ) ) );
Mark Wielaard 302637
          break;
Mark Wielaard 302637
+      case 0x216: /* xscvdpspn (VSX Scalar convert scalar Single-Precision to
Mark Wielaard 302637
+                              vector single Convert to Single-Precision non-signalling */
Mark Wielaard 302637
+         DIP("xscvdpspn v%u,v%u\n",  (UInt)XT, (UInt)XB);
Mark Wielaard 302637
+         putVSReg( XT,
Mark Wielaard 302637
+                   binop( Iop_64HLtoV128,
Mark Wielaard 302637
+                          binop( Iop_32HLto64,
Mark Wielaard 302637
+                                 unop( Iop_ReinterpF32asI32,
Mark Wielaard 302637
+                                       unop( Iop_TruncF64asF32,
Mark Wielaard 302637
+                                             mkexpr( xB ) ) ),
Mark Wielaard 302637
+                                             mkU32( 0 ) ),
Mark Wielaard 302637
+                                             mkU64( 0ULL ) ) );
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
       case 0x090: // xscvdpuxws (VSX Scalar truncate Double-Precision to integer
Mark Wielaard 302637
                   //             and Convert to Unsigned Integer Word format with Saturate)
Mark Wielaard 302637
          DIP("xscvdpuxws v%u,v%u\n",  (UInt)XT, (UInt)XB);
Mark Wielaard 302637
@@ -11845,6 +11940,15 @@
Mark Wielaard 302637
                                       unop( Iop_ReinterpI32asF32, mkexpr( xB ) ) ) ),
Mark Wielaard 302637
                           mkU64( 0ULL ) ) );
Mark Wielaard 302637
          break;
Mark Wielaard 302637
+      case 0x296: // xscvspdpn (VSX Scalar Convert Single-Precision to Double-Precision format Non signaling)
Mark Wielaard 302637
+         DIP("xscvspdpn v%u,v%u\n",  (UInt)XT, (UInt)XB);
Mark Wielaard 302637
+         putVSReg( XT,
Mark Wielaard 302637
+                   binop( Iop_64HLtoV128,
Mark Wielaard 302637
+                          unop( Iop_ReinterpF64asI64,
Mark Wielaard 302637
+                                unop( Iop_F32toF64,
Mark Wielaard 302637
+                                      unop( Iop_ReinterpI32asF32, mkexpr( xB ) ) ) ),
Mark Wielaard 302637
+                                      mkU64( 0ULL ) ) );
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
       case 0x312: // xvcvdpsp (VSX Vector round Double-Precision to single-precision
Mark Wielaard 302637
                   //           and Convert to Single-Precision format)
Mark Wielaard 302637
          DIP("xvcvdpsp v%u,v%u\n",  (UInt)XT, (UInt)XB);
Mark Wielaard 302637
@@ -14552,6 +14656,11 @@
Mark Wielaard 302637
       putVReg( vD_addr, binop(Iop_Add32x4, mkexpr(vA), mkexpr(vB)) );
Mark Wielaard 302637
       break;
Mark Wielaard 302637
 
Mark Wielaard 302637
+   case 0x0C0: // vaddudm (Add Unsigned Double Word Modulo)
Mark Wielaard 302637
+      DIP("vaddudm v%d,v%d,v%d\n", vD_addr, vA_addr, vB_addr);
Mark Wielaard 302637
+      putVReg( vD_addr, binop(Iop_Add64x2, mkexpr(vA), mkexpr(vB)) );
Mark Wielaard 302637
+      break;
Mark Wielaard 302637
+
Mark Wielaard 302637
    case 0x200: // vaddubs (Add Unsigned Byte Saturate, AV p142)
Mark Wielaard 302637
       DIP("vaddubs v%d,v%d,v%d\n", vD_addr, vA_addr, vB_addr);
Mark Wielaard 302637
       putVReg( vD_addr, binop(Iop_QAdd8Ux16, mkexpr(vA), mkexpr(vB)) );
Mark Wielaard 302637
@@ -15824,6 +15933,12 @@
Mark Wielaard 302637
       return True;
Mark Wielaard 302637
    }
Mark Wielaard 302637
 
Mark Wielaard 302637
+   case 0x44E: // vpkudum (Pack Unsigned Double Word Unsigned Modulo)
Mark Wielaard 302637
+      DIP("vpkudum v%d,v%d,v%d\n", vD_addr, vA_addr, vB_addr);
Mark Wielaard 302637
+      putVReg( vD_addr,
Mark Wielaard 302637
+               binop(Iop_NarrowBin64to32x4, mkexpr(vA), mkexpr(vB)) );
Mark Wielaard 302637
+      return True;
Mark Wielaard 302637
+
Mark Wielaard 302637
    default:
Mark Wielaard 302637
       break; // Fall through...
Mark Wielaard 302637
    }
Mark Wielaard 302637
@@ -16356,6 +16471,7 @@
Mark Wielaard 302637
       { 0x1f4, "xvtdivdp" },
Mark Wielaard 302637
       { 0x208, "xxland" },
Mark Wielaard 302637
       { 0x212, "xscvdpsp" },
Mark Wielaard 302637
+      { 0x216, "xscvdpspn" },
Mark Wielaard 302637
       { 0x228, "xxlandc" },
Mark Wielaard 302637
       { 0x248 , "xxlor" },
Mark Wielaard 302637
       { 0x268, "xxlxor" },
Mark Wielaard 302637
@@ -16364,6 +16480,7 @@
Mark Wielaard 302637
       { 0x288, "xxlnor" },
Mark Wielaard 302637
       { 0x290, "xscvdpuxds" },
Mark Wielaard 302637
       { 0x292, "xscvspdp" },
Mark Wielaard 302637
+      { 0x296, "xscvspdpn" },
Mark Wielaard 302637
       { 0x2a0, "xsmindp" },
Mark Wielaard 302637
       { 0x2a4, "xsnmaddmdp" },
Mark Wielaard 302637
       { 0x2b0, "xscvdpsxds" },
Mark Wielaard 302637
@@ -16412,7 +16529,8 @@
Mark Wielaard 302637
       { 0x3f0, "xvcvsxddp" },
Mark Wielaard 302637
       { 0x3f2, "xvnegdp" }
Mark Wielaard 302637
 };
Mark Wielaard 302637
-#define VSX_ALL_LEN 135
Mark Wielaard 302637
+#define VSX_ALL_LEN (sizeof vsx_all / sizeof *vsx_all)
Mark Wielaard 302637
+
Mark Wielaard 302637
 
Mark Wielaard 302637
 // ATTENTION: This search function assumes vsx_all array is sorted.
Mark Wielaard 302637
 static Int findVSXextOpCode(UInt opcode)
Mark Wielaard 302637
@@ -16490,6 +16608,7 @@
Mark Wielaard 302637
    Bool      allow_GX = False;
Mark Wielaard 302637
    Bool      allow_VX = False;  // Equates to "supports Power ISA 2.06
Mark Wielaard 302637
    Bool      allow_DFP = False;
Mark Wielaard 302637
+   Bool      allow_isa_2_07 = False;
Mark Wielaard 302637
    UInt      hwcaps = archinfo->hwcaps;
Mark Wielaard 302637
    Long      delta;
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -16501,6 +16620,7 @@
Mark Wielaard 302637
       allow_GX = (0 != (hwcaps & VEX_HWCAPS_PPC64_GX));
Mark Wielaard 302637
       allow_VX = (0 != (hwcaps & VEX_HWCAPS_PPC64_VX));
Mark Wielaard 302637
       allow_DFP = (0 != (hwcaps & VEX_HWCAPS_PPC64_DFP));
Mark Wielaard 302637
+      allow_isa_2_07 = (0 != (hwcaps & VEX_HWCAPS_PPC64_ISA2_07));
Mark Wielaard 302637
    } else {
Mark Wielaard 302637
       allow_F  = (0 != (hwcaps & VEX_HWCAPS_PPC32_F));
Mark Wielaard 302637
       allow_V  = (0 != (hwcaps & VEX_HWCAPS_PPC32_V));
Mark Wielaard 302637
@@ -16508,6 +16628,7 @@
Mark Wielaard 302637
       allow_GX = (0 != (hwcaps & VEX_HWCAPS_PPC32_GX));
Mark Wielaard 302637
       allow_VX = (0 != (hwcaps & VEX_HWCAPS_PPC32_VX));
Mark Wielaard 302637
       allow_DFP = (0 != (hwcaps & VEX_HWCAPS_PPC32_DFP));
Mark Wielaard 302637
+      allow_isa_2_07 = (0 != (hwcaps & VEX_HWCAPS_PPC32_ISA2_07));
Mark Wielaard 302637
    }
Mark Wielaard 302637
 
Mark Wielaard 302637
    /* The running delta */
Mark Wielaard 302637
@@ -16928,8 +17049,9 @@
Mark Wielaard 302637
          case 0x2B0: case 0x2F0: // xscvdpsxds, xscvsxddp
Mark Wielaard 302637
          case 0x1b0: case 0x130: // xvcvdpsxws, xvcvspsxws
Mark Wielaard 302637
          case 0x0b0: case 0x290: // xscvdpsxws, xscvdpuxds
Mark Wielaard 302637
-         case 0x212: // xscvdpsp
Mark Wielaard 302637
-         case 0x292: case 0x312: // xscvspdp, xvcvdpsp
Mark Wielaard 302637
+         case 0x212: case 0x216: // xscvdpsp, xscvdpspn
Mark Wielaard 302637
+         case 0x292: case 0x296: // xscvspdp, xscvspdpn
Mark Wielaard 302637
+         case 0x312: // xvcvdpsp
Mark Wielaard 302637
          case 0x390: case 0x190: // xvcvdpuxds, xvcvdpuxws
Mark Wielaard 302637
          case 0x3B0: case 0x310: // xvcvdpsxds, xvcvspuxds
Mark Wielaard 302637
          case 0x392: case 0x330: // xvcvspdp, xvcvspsxds
Mark Wielaard 302637
@@ -16973,7 +17095,6 @@
Mark Wielaard 302637
 
Mark Wielaard 302637
    /* 64bit Integer Stores */
Mark Wielaard 302637
    case 0x3E:  // std, stdu
Mark Wielaard 302637
-      if (!mode64) goto decode_failure;
Mark Wielaard 302637
       if (dis_int_store( theInstr, abiinfo )) goto decode_success;
Mark Wielaard 302637
       goto decode_failure;
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -17008,7 +17129,7 @@
Mark Wielaard 302637
          if (!allow_GX) goto decode_noGX;
Mark Wielaard 302637
          if (dis_fp_arith(theInstr)) goto decode_success;
Mark Wielaard 302637
          goto decode_failure;
Mark Wielaard 302637
-         
Mark Wielaard 302637
+
Mark Wielaard 302637
       default:
Mark Wielaard 302637
          break; // Fall through
Mark Wielaard 302637
       }
Mark Wielaard 302637
@@ -17358,6 +17479,8 @@
Mark Wielaard 302637
          goto decode_failure;
Mark Wielaard 302637
 
Mark Wielaard 302637
       /* Processor Control Instructions */
Mark Wielaard 302637
+      case 0x33:  // mfvsrd
Mark Wielaard 302637
+      case 0xB3:  case 0xD3: // mtvsrd, mtvsrwa
Mark Wielaard 302637
       case 0x200: case 0x013: case 0x153: // mcrxr, mfcr,  mfspr
Mark Wielaard 302637
       case 0x173: case 0x090: case 0x1D3: // mftb,  mtcrf, mtspr
Mark Wielaard 302637
          if (dis_proc_ctl( abiinfo, theInstr )) goto decode_success;
Mark Wielaard 302637
@@ -17564,6 +17687,11 @@
Mark Wielaard 302637
          if (dis_av_arith( theInstr )) goto decode_success;
Mark Wielaard 302637
          goto decode_failure;
Mark Wielaard 302637
 
Mark Wielaard 302637
+      case 0x0C0:                         // vaddudm
Mark Wielaard 302637
+         if (!allow_isa_2_07) goto decode_noP8;
Mark Wielaard 302637
+         if (dis_av_arith( theInstr )) goto decode_success;
Mark Wielaard 302637
+         goto decode_failure;
Mark Wielaard 302637
+
Mark Wielaard 302637
       /* AV Rotate, Shift */
Mark Wielaard 302637
       case 0x004: case 0x044: case 0x084: // vrlb, vrlh, vrlw
Mark Wielaard 302637
       case 0x104: case 0x144: case 0x184: // vslb, vslh, vslw
Mark Wielaard 302637
@@ -17627,6 +17755,11 @@
Mark Wielaard 302637
          if (dis_av_pack( theInstr )) goto decode_success;
Mark Wielaard 302637
          goto decode_failure;
Mark Wielaard 302637
 
Mark Wielaard 302637
+      case 0x44E: // vpkudum
Mark Wielaard 302637
+         if (!allow_isa_2_07) goto decode_noP8;
Mark Wielaard 302637
+         if (dis_av_pack( theInstr )) goto decode_success;
Mark Wielaard 302637
+         goto decode_failure;
Mark Wielaard 302637
+
Mark Wielaard 302637
       default:
Mark Wielaard 302637
          break;  // Fall through...
Mark Wielaard 302637
       }
Mark Wielaard 302637
@@ -17684,6 +17817,11 @@
Mark Wielaard 302637
       vex_printf("disInstr(ppc): "
Mark Wielaard 302637
                "declined to decode a Decimal Floating Point insn.\n");
Mark Wielaard 302637
       goto decode_failure;
Mark Wielaard 302637
+   decode_noP8:
Mark Wielaard 302637
+      vassert(!allow_isa_2_07);
Mark Wielaard 302637
+      vex_printf("disInstr(ppc): "
Mark Wielaard 302637
+               "declined to decode a Power 8 insn.\n");
Mark Wielaard 302637
+      goto decode_failure;
Mark Wielaard 302637
 
Mark Wielaard 302637
 
Mark Wielaard 302637
    decode_failure:
Mark Wielaard 302637
@@ -17772,10 +17910,11 @@
Mark Wielaard 302637
    /* do some sanity checks */
Mark Wielaard 302637
    mask32 = VEX_HWCAPS_PPC32_F | VEX_HWCAPS_PPC32_V
Mark Wielaard 302637
             | VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX
Mark Wielaard 302637
-            | VEX_HWCAPS_PPC32_DFP;
Mark Wielaard 302637
+            | VEX_HWCAPS_PPC32_DFP | VEX_HWCAPS_PPC32_ISA2_07;
Mark Wielaard 302637
 
Mark Wielaard 302637
    mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX
Mark Wielaard 302637
-		   | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP;
Mark Wielaard 302637
+            | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP
Mark Wielaard 302637
+            | VEX_HWCAPS_PPC64_ISA2_07;
Mark Wielaard 302637
 
Mark Wielaard 302637
    if (mode64) {
Mark Wielaard 302637
       vassert((hwcaps_guest & mask32) == 0);
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/priv/host_ppc_defs.c valgrind-3.8.1/VEX/priv/host_ppc_defs.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/priv/host_ppc_defs.c	2013-08-13 13:07:12.726887180 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/priv/host_ppc_defs.c	2013-08-13 13:10:17.466218906 +0200
Mark Wielaard 302637
@@ -674,7 +674,7 @@
Mark Wielaard 302637
    case Pav_UNPCKLPIX: return "vupklpx";
Mark Wielaard 302637
 
Mark Wielaard 302637
    /* Integer binary */
Mark Wielaard 302637
-   case Pav_ADDU:      return "vaddu_m";  // b,h,w
Mark Wielaard 302637
+   case Pav_ADDU:      return "vaddu_m";  // b,h,w,dw
Mark Wielaard 302637
    case Pav_QADDU:     return "vaddu_s";  // b,h,w
Mark Wielaard 302637
    case Pav_QADDS:     return "vadds_s";  // b,h,w
Mark Wielaard 302637
      
Mark Wielaard 302637
@@ -708,7 +708,7 @@
Mark Wielaard 302637
    case Pav_ROTL:      return "vrl";      // b,h,w
Mark Wielaard 302637
 
Mark Wielaard 302637
    /* Pack */
Mark Wielaard 302637
-   case Pav_PACKUU:    return "vpku_um";  // h,w
Mark Wielaard 302637
+   case Pav_PACKUU:    return "vpku_um";  // h,w,dw
Mark Wielaard 302637
    case Pav_QPACKUU:   return "vpku_us";  // h,w
Mark Wielaard 302637
    case Pav_QPACKSU:   return "vpks_us";  // h,w
Mark Wielaard 302637
    case Pav_QPACKSS:   return "vpks_ss";  // h,w
Mark Wielaard 302637
@@ -1346,6 +1346,17 @@
Mark Wielaard 302637
    i->Pin.AvBin32x4.srcR = srcR;
Mark Wielaard 302637
    return i;
Mark Wielaard 302637
 }
Mark Wielaard 302637
+PPCInstr* PPCInstr_AvBin64x2 ( PPCAvOp op, HReg dst,
Mark Wielaard 302637
+                               HReg srcL, HReg srcR ) {
Mark Wielaard 302637
+   PPCInstr* i           = LibVEX_Alloc(sizeof(PPCInstr));
Mark Wielaard 302637
+   i->tag                = Pin_AvBin64x2;
Mark Wielaard 302637
+   i->Pin.AvBin64x2.op   = op;
Mark Wielaard 302637
+   i->Pin.AvBin64x2.dst  = dst;
Mark Wielaard 302637
+   i->Pin.AvBin64x2.srcL = srcL;
Mark Wielaard 302637
+   i->Pin.AvBin64x2.srcR = srcR;
Mark Wielaard 302637
+   return i;
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
 PPCInstr* PPCInstr_AvBin32Fx4 ( PPCAvFpOp op, HReg dst,
Mark Wielaard 302637
                                 HReg srcL, HReg srcR ) {
Mark Wielaard 302637
    PPCInstr* i            = LibVEX_Alloc(sizeof(PPCInstr));
Mark Wielaard 302637
@@ -1879,6 +1890,14 @@
Mark Wielaard 302637
       vex_printf(",");
Mark Wielaard 302637
       ppHRegPPC(i->Pin.AvBin32x4.srcR);
Mark Wielaard 302637
       return;
Mark Wielaard 302637
+   case Pin_AvBin64x2:
Mark Wielaard 302637
+      vex_printf("%s(w) ", showPPCAvOp(i->Pin.AvBin64x2.op));
Mark Wielaard 302637
+      ppHRegPPC(i->Pin.AvBin64x2.dst);
Mark Wielaard 302637
+      vex_printf(",");
Mark Wielaard 302637
+      ppHRegPPC(i->Pin.AvBin64x2.srcL);
Mark Wielaard 302637
+      vex_printf(",");
Mark Wielaard 302637
+      ppHRegPPC(i->Pin.AvBin64x2.srcR);
Mark Wielaard 302637
+      return;
Mark Wielaard 302637
    case Pin_AvBin32Fx4:
Mark Wielaard 302637
       vex_printf("%s ", showPPCAvFpOp(i->Pin.AvBin32Fx4.op));
Mark Wielaard 302637
       ppHRegPPC(i->Pin.AvBin32Fx4.dst);
Mark Wielaard 302637
@@ -2360,6 +2379,11 @@
Mark Wielaard 302637
       addHRegUse(u, HRmRead,  i->Pin.AvBin32x4.srcL);
Mark Wielaard 302637
       addHRegUse(u, HRmRead,  i->Pin.AvBin32x4.srcR);
Mark Wielaard 302637
       return;
Mark Wielaard 302637
+   case Pin_AvBin64x2:
Mark Wielaard 302637
+      addHRegUse(u, HRmWrite, i->Pin.AvBin64x2.dst);
Mark Wielaard 302637
+      addHRegUse(u, HRmRead,  i->Pin.AvBin64x2.srcL);
Mark Wielaard 302637
+      addHRegUse(u, HRmRead,  i->Pin.AvBin64x2.srcR);
Mark Wielaard 302637
+      return;
Mark Wielaard 302637
    case Pin_AvBin32Fx4:
Mark Wielaard 302637
       addHRegUse(u, HRmWrite, i->Pin.AvBin32Fx4.dst);
Mark Wielaard 302637
       addHRegUse(u, HRmRead,  i->Pin.AvBin32Fx4.srcL);
Mark Wielaard 302637
@@ -2666,6 +2690,11 @@
Mark Wielaard 302637
       mapReg(m, &i->Pin.AvBin32x4.srcL);
Mark Wielaard 302637
       mapReg(m, &i->Pin.AvBin32x4.srcR);
Mark Wielaard 302637
       return;
Mark Wielaard 302637
+   case Pin_AvBin64x2:
Mark Wielaard 302637
+      mapReg(m, &i->Pin.AvBin64x2.dst);
Mark Wielaard 302637
+      mapReg(m, &i->Pin.AvBin64x2.srcL);
Mark Wielaard 302637
+      mapReg(m, &i->Pin.AvBin64x2.srcR);
Mark Wielaard 302637
+      return;
Mark Wielaard 302637
    case Pin_AvBin32Fx4:
Mark Wielaard 302637
       mapReg(m, &i->Pin.AvBin32Fx4.dst);
Mark Wielaard 302637
       mapReg(m, &i->Pin.AvBin32Fx4.srcL);
Mark Wielaard 302637
@@ -4771,6 +4800,24 @@
Mark Wielaard 302637
       goto done;
Mark Wielaard 302637
    }
Mark Wielaard 302637
 
Mark Wielaard 302637
+   case Pin_AvBin64x2: {
Mark Wielaard 302637
+      UInt v_dst  = vregNo(i->Pin.AvBin64x2.dst);
Mark Wielaard 302637
+      UInt v_srcL = vregNo(i->Pin.AvBin64x2.srcL);
Mark Wielaard 302637
+      UInt v_srcR = vregNo(i->Pin.AvBin64x2.srcR);
Mark Wielaard 302637
+      UInt opc2;
Mark Wielaard 302637
+      switch (i->Pin.AvBin64x2.op) {
Mark Wielaard 302637
+         case Pav_ADDU:    opc2 =  192; break; // vaddudm  vector double add
Mark Wielaard 302637
+         case Pav_PACKUU:  opc2 = 1102; break; // vpkudum
Mark Wielaard 302637
+         // FIXME: We currently don't have a vector compare equal double word, so it's a hack
Mark Wielaard 302637
+         // to use vcmpequw, but it works.
Mark Wielaard 302637
+         case Pav_CMPEQU:  opc2 =  134; break; // vcmpequw
Mark Wielaard 302637
+         default:
Mark Wielaard 302637
+            goto bad;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+      p = mkFormVX( p, 4, v_dst, v_srcL, v_srcR, opc2 );
Mark Wielaard 302637
+      goto done;
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+
Mark Wielaard 302637
    case Pin_AvBin32Fx4: {
Mark Wielaard 302637
       UInt v_dst  = vregNo(i->Pin.AvBin32Fx4.dst);
Mark Wielaard 302637
       UInt v_srcL = vregNo(i->Pin.AvBin32Fx4.srcL);
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/priv/host_ppc_defs.h valgrind-3.8.1/VEX/priv/host_ppc_defs.h
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/priv/host_ppc_defs.h	2013-08-13 13:07:12.724887166 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/priv/host_ppc_defs.h	2013-08-13 13:10:17.469218928 +0200
Mark Wielaard 302637
@@ -488,6 +488,7 @@
Mark Wielaard 302637
       Pin_AvBin8x16,  /* AV binary, 8x4 */
Mark Wielaard 302637
       Pin_AvBin16x8,  /* AV binary, 16x4 */
Mark Wielaard 302637
       Pin_AvBin32x4,  /* AV binary, 32x4 */
Mark Wielaard 302637
+      Pin_AvBin64x2,  /* AV binary, 64x2 */
Mark Wielaard 302637
 
Mark Wielaard 302637
       Pin_AvBin32Fx4, /* AV FP binary, 32Fx4 */
Mark Wielaard 302637
       Pin_AvUn32Fx4,  /* AV FP unary,  32Fx4 */
Mark Wielaard 302637
@@ -790,6 +791,13 @@
Mark Wielaard 302637
             HReg    srcL;
Mark Wielaard 302637
             HReg    srcR;
Mark Wielaard 302637
          } AvBin32x4;
Mark Wielaard 302637
+         /* Can only be generated for CPUs capable of ISA 2.07 or above */
Mark Wielaard 302637
+         struct {
Mark Wielaard 302637
+            PPCAvOp op;
Mark Wielaard 302637
+            HReg    dst;
Mark Wielaard 302637
+            HReg    srcL;
Mark Wielaard 302637
+            HReg    srcR;
Mark Wielaard 302637
+         } AvBin64x2;
Mark Wielaard 302637
          struct {
Mark Wielaard 302637
             PPCAvFpOp op;
Mark Wielaard 302637
             HReg      dst;
Mark Wielaard 302637
@@ -1008,6 +1016,7 @@
Mark Wielaard 302637
 extern PPCInstr* PPCInstr_AvBin8x16  ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
Mark Wielaard 302637
 extern PPCInstr* PPCInstr_AvBin16x8  ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
Mark Wielaard 302637
 extern PPCInstr* PPCInstr_AvBin32x4  ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
Mark Wielaard 302637
+extern PPCInstr* PPCInstr_AvBin64x2  ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
Mark Wielaard 302637
 extern PPCInstr* PPCInstr_AvBin32Fx4 ( PPCAvFpOp op, HReg dst, HReg srcL, HReg srcR );
Mark Wielaard 302637
 extern PPCInstr* PPCInstr_AvUn32Fx4  ( PPCAvFpOp op, HReg dst, HReg src );
Mark Wielaard 302637
 extern PPCInstr* PPCInstr_AvPerm     ( HReg dst, HReg srcL, HReg srcR, HReg ctl );
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/priv/host_ppc_isel.c valgrind-3.8.1/VEX/priv/host_ppc_isel.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/priv/host_ppc_isel.c	2013-08-13 13:07:12.732887222 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/priv/host_ppc_isel.c	2013-08-13 13:10:17.474218963 +0200
Mark Wielaard 302637
@@ -4325,6 +4325,16 @@
Mark Wielaard 302637
          return dst;
Mark Wielaard 302637
       }
Mark Wielaard 302637
 
Mark Wielaard 302637
+      case Iop_CmpNEZ64x2: {
Mark Wielaard 302637
+         HReg arg  = iselVecExpr(env, e->Iex.Unop.arg);
Mark Wielaard 302637
+         HReg zero = newVRegV(env);
Mark Wielaard 302637
+         HReg dst  = newVRegV(env);
Mark Wielaard 302637
+         addInstr(env, PPCInstr_AvBinary(Pav_XOR, zero, zero, zero));
Mark Wielaard 302637
+         addInstr(env, PPCInstr_AvBin64x2(Pav_CMPEQU, dst, arg, zero));
Mark Wielaard 302637
+         addInstr(env, PPCInstr_AvUnary(Pav_NOT, dst, dst));
Mark Wielaard 302637
+         return dst;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+
Mark Wielaard 302637
       case Iop_Recip32Fx4:    fpop = Pavfp_RCPF;    goto do_32Fx4_unary;
Mark Wielaard 302637
       case Iop_RSqrt32Fx4:    fpop = Pavfp_RSQRTF;  goto do_32Fx4_unary;
Mark Wielaard 302637
       case Iop_I32UtoFx4:     fpop = Pavfp_CVTU2F;  goto do_32Fx4_unary;
Mark Wielaard 302637
@@ -4589,6 +4599,16 @@
Mark Wielaard 302637
          return dst;
Mark Wielaard 302637
       }
Mark Wielaard 302637
 
Mark Wielaard 302637
+      case Iop_NarrowBin64to32x4:    op = Pav_PACKUU;  goto do_AvBin64x2;
Mark Wielaard 302637
+      case Iop_Add64x2:    op = Pav_ADDU;   goto do_AvBin64x2;
Mark Wielaard 302637
+      do_AvBin64x2: {
Mark Wielaard 302637
+         HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1);
Mark Wielaard 302637
+         HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2);
Mark Wielaard 302637
+         HReg dst  = newVRegV(env);
Mark Wielaard 302637
+         addInstr(env, PPCInstr_AvBin64x2(op, dst, arg1, arg2));
Mark Wielaard 302637
+         return dst;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+
Mark Wielaard 302637
       case Iop_ShlN8x16: op = Pav_SHL; goto do_AvShift8x16;
Mark Wielaard 302637
       case Iop_SarN8x16: op = Pav_SAR; goto do_AvShift8x16;
Mark Wielaard 302637
       do_AvShift8x16: {
Mark Wielaard 302637
@@ -5233,10 +5253,12 @@
Mark Wielaard 302637
    /* do some sanity checks */
Mark Wielaard 302637
    mask32 = VEX_HWCAPS_PPC32_F | VEX_HWCAPS_PPC32_V
Mark Wielaard 302637
             | VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX
Mark Wielaard 302637
-            | VEX_HWCAPS_PPC32_DFP;
Mark Wielaard 302637
+            | VEX_HWCAPS_PPC32_DFP | VEX_HWCAPS_PPC32_ISA2_07;
Mark Wielaard 302637
+
Mark Wielaard 302637
 
Mark Wielaard 302637
    mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX
Mark Wielaard 302637
-	   | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP;
Mark Wielaard 302637
+            | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP
Mark Wielaard 302637
+            | VEX_HWCAPS_PPC64_ISA2_07;
Mark Wielaard 302637
 
Mark Wielaard 302637
    if (mode64) {
Mark Wielaard 302637
       vassert((hwcaps_host & mask32) == 0);
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/priv/ir_defs.c valgrind-3.8.1/VEX/priv/ir_defs.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/priv/ir_defs.c	2013-08-13 13:07:12.728887194 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/priv/ir_defs.c	2013-08-13 13:10:17.477218984 +0200
Mark Wielaard 302637
@@ -523,6 +523,7 @@
Mark Wielaard 302637
       case Iop_QNarrowBin32Sto16Sx4: vex_printf("QNarrowBin32Sto16Sx4"); return;
Mark Wielaard 302637
       case Iop_NarrowBin16to8x8: vex_printf("NarrowBin16to8x8"); return;
Mark Wielaard 302637
       case Iop_NarrowBin32to16x4: vex_printf("NarrowBin32to16x4"); return;
Mark Wielaard 302637
+      case Iop_NarrowBin64to32x4: vex_printf("NarrowBin64to32x4"); return;
Mark Wielaard 302637
       case Iop_InterleaveHI8x8: vex_printf("InterleaveHI8x8"); return;
Mark Wielaard 302637
       case Iop_InterleaveHI16x4: vex_printf("InterleaveHI16x4"); return;
Mark Wielaard 302637
       case Iop_InterleaveHI32x2: vex_printf("InterleaveHI32x2"); return;
Mark Wielaard 302637
@@ -2650,6 +2651,7 @@
Mark Wielaard 302637
       case Iop_QNarrowBin16Sto8Sx16: case Iop_QNarrowBin32Sto16Sx8:
Mark Wielaard 302637
       case Iop_QNarrowBin16Uto8Ux16: case Iop_QNarrowBin32Uto16Ux8:
Mark Wielaard 302637
       case Iop_NarrowBin16to8x16:   case Iop_NarrowBin32to16x8:
Mark Wielaard 302637
+      case Iop_NarrowBin64to32x4:
Mark Wielaard 302637
       case Iop_InterleaveHI8x16: case Iop_InterleaveHI16x8:
Mark Wielaard 302637
       case Iop_InterleaveHI32x4: case Iop_InterleaveHI64x2:
Mark Wielaard 302637
       case Iop_InterleaveLO8x16: case Iop_InterleaveLO16x8:
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/priv/main_main.c valgrind-3.8.1/VEX/priv/main_main.c
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/priv/main_main.c	2013-08-13 13:07:12.732887222 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/priv/main_main.c	2013-08-13 13:10:17.479218998 +0200
Mark Wielaard 302637
@@ -1164,6 +1164,7 @@
Mark Wielaard 302637
    const UInt GX = VEX_HWCAPS_PPC32_GX;
Mark Wielaard 302637
    const UInt VX = VEX_HWCAPS_PPC32_VX;
Mark Wielaard 302637
    const UInt DFP = VEX_HWCAPS_PPC32_DFP;
Mark Wielaard 302637
+   const UInt ISA2_07 = VEX_HWCAPS_PPC32_ISA2_07;
Mark Wielaard 302637
          UInt c  = hwcaps;
Mark Wielaard 302637
    if (c == 0)           return "ppc32-int";
Mark Wielaard 302637
    if (c == F)           return "ppc32-int-flt";
Mark Wielaard 302637
@@ -1176,6 +1177,9 @@
Mark Wielaard 302637
    if (c == (F|V|FX|GX)) return "ppc32-int-flt-vmx-FX-GX";
Mark Wielaard 302637
    if (c == (F|V|FX|GX|DFP))    return "ppc32-int-flt-vmx-FX-GX-DFP";
Mark Wielaard 302637
    if (c == (F|V|FX|GX|VX|DFP)) return "ppc32-int-flt-vmx-FX-GX-VX-DFP";
Mark Wielaard 302637
+   if (c == (F|V|FX|GX|VX|DFP|ISA2_07))
Mark Wielaard 302637
+      return "ppc32-int-flt-vmx-FX-GX-VX-DFP-ISA2_07";
Mark Wielaard 302637
+
Mark Wielaard 302637
    return NULL;
Mark Wielaard 302637
 }
Mark Wielaard 302637
 
Mark Wielaard 302637
@@ -1188,6 +1192,7 @@
Mark Wielaard 302637
    const UInt GX = VEX_HWCAPS_PPC64_GX;
Mark Wielaard 302637
    const UInt VX = VEX_HWCAPS_PPC64_VX;
Mark Wielaard 302637
    const UInt DFP = VEX_HWCAPS_PPC64_DFP;
Mark Wielaard 302637
+   const UInt ISA2_07 = VEX_HWCAPS_PPC64_ISA2_07;
Mark Wielaard 302637
          UInt c  = hwcaps;
Mark Wielaard 302637
    if (c == 0)         return "ppc64-int-flt";
Mark Wielaard 302637
    if (c == FX)        return "ppc64-int-flt-FX";
Mark Wielaard 302637
@@ -1199,6 +1204,8 @@
Mark Wielaard 302637
    if (c == (V|FX|GX)) return "ppc64-int-flt-vmx-FX-GX";
Mark Wielaard 302637
    if (c == (V|FX|GX|DFP))    return "ppc64-int-flt-vmx-FX-GX-DFP";
Mark Wielaard 302637
    if (c == (V|FX|GX|VX|DFP)) return "ppc64-int-flt-vmx-FX-GX-VX-DFP";
Mark Wielaard 302637
+   if (c == (V|FX|GX|VX|DFP|ISA2_07))
Mark Wielaard 302637
+      return "ppc64-int-flt-vmx-FX-GX-VX-DFP-ISA2_07";
Mark Wielaard 302637
    return NULL;
Mark Wielaard 302637
 }
Mark Wielaard 302637
 
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/pub/libvex.h valgrind-3.8.1/VEX/pub/libvex.h
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/pub/libvex.h	2013-08-13 13:07:12.724887166 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/pub/libvex.h	2013-08-13 13:10:17.481219013 +0200
Mark Wielaard 302637
@@ -93,6 +93,7 @@
Mark Wielaard 302637
                                           (fres,frsqrte,fsel,stfiwx) */
Mark Wielaard 302637
 #define VEX_HWCAPS_PPC32_VX    (1<<12) /* Vector-scalar floating-point (VSX); implies ISA 2.06 or higher  */
Mark Wielaard 302637
 #define VEX_HWCAPS_PPC32_DFP   (1<<17) /* Decimal Floating Point (DFP) -- e.g., dadd */
Mark Wielaard 302637
+#define VEX_HWCAPS_PPC32_ISA2_07   (1<<19) /* ISA 2.07 -- e.g., mtvsrd */
Mark Wielaard 302637
 
Mark Wielaard 302637
 /* ppc64: baseline capability is integer and basic FP insns */
Mark Wielaard 302637
 #define VEX_HWCAPS_PPC64_V     (1<<13) /* Altivec (VMX) */
Mark Wielaard 302637
@@ -101,6 +102,7 @@
Mark Wielaard 302637
                                           (fres,frsqrte,fsel,stfiwx) */
Mark Wielaard 302637
 #define VEX_HWCAPS_PPC64_VX    (1<<16) /* Vector-scalar floating-point (VSX); implies ISA 2.06 or higher  */
Mark Wielaard 302637
 #define VEX_HWCAPS_PPC64_DFP   (1<<18) /* Decimal Floating Point (DFP) -- e.g., dadd */
Mark Wielaard 302637
+#define VEX_HWCAPS_PPC64_ISA2_07   (1<<20) /* ISA 2.07 -- e.g., mtvsrd */
Mark Wielaard 302637
 
Mark Wielaard 302637
 /* s390x: Hardware capability encoding
Mark Wielaard 302637
 
Mark Wielaard 302637
diff -ur valgrind-3.8.1.orig/VEX/pub/libvex_ir.h valgrind-3.8.1/VEX/pub/libvex_ir.h
Mark Wielaard 302637
--- valgrind-3.8.1.orig/VEX/pub/libvex_ir.h	2013-08-13 13:07:12.724887166 +0200
Mark Wielaard 302637
+++ valgrind-3.8.1/VEX/pub/libvex_ir.h	2013-08-13 13:10:17.482219021 +0200
Mark Wielaard 302637
@@ -1354,6 +1354,7 @@
Mark Wielaard 302637
       Iop_QNarrowBin16Sto8Sx16, Iop_QNarrowBin32Sto16Sx8,
Mark Wielaard 302637
       Iop_QNarrowBin16Uto8Ux16, Iop_QNarrowBin32Uto16Ux8,
Mark Wielaard 302637
       Iop_NarrowBin16to8x16, Iop_NarrowBin32to16x8,
Mark Wielaard 302637
+      Iop_NarrowBin64to32x4,
Mark Wielaard 302637
 
Mark Wielaard 302637
       /* NARROWING (unary) -- narrow V128 into I64 */
Mark Wielaard 302637
       Iop_NarrowUn16to8x8, Iop_NarrowUn32to16x4, Iop_NarrowUn64to32x2,
Mark Wielaard 302637
    
Mark Wielaard 302637
diff --git a/none/tests/ppc32/jm_vec_isa_2_07.stderr.exp b/none/tests/ppc32/jm_vec_isa_2_07.stderr.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..139597f
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/jm_vec_isa_2_07.stderr.exp
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
diff --git a/none/tests/ppc32/jm_vec_isa_2_07.stdout.exp b/none/tests/ppc32/jm_vec_isa_2_07.stdout.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..a2d83e6
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/jm_vec_isa_2_07.stdout.exp
Mark Wielaard 302637
@@ -0,0 +1,34 @@
Mark Wielaard 302637
+mfvsrd: 0102030405060708 => 0000000005060708
Mark Wielaard 302637
+mfvsrd: 090a0b0c0e0d0e0f => 000000000e0d0e0f
Mark Wielaard 302637
+mfvsrd: f1f2f3f4f5f6f7f8 => 00000000f5f6f7f8
Mark Wielaard 302637
+mfvsrd: f9fafbfcfefdfeff => 00000000fefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+mtvsrd: 0102030405060708 => 0000000005060708
Mark Wielaard 302637
+mtvsrd: 090a0b0c0e0d0e0f => 000000000e0d0e0f
Mark Wielaard 302637
+mtvsrd: f1f2f3f4f5f6f7f8 => 00000000f5f6f7f8
Mark Wielaard 302637
+mtvsrd: f9fafbfcfefdfeff => 00000000fefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+mtfprwa: 05060708 => 0000000005060708
Mark Wielaard 302637
+mtfprwa: 0e0d0e0f => 000000000e0d0e0f
Mark Wielaard 302637
+mtfprwa: f5f6f7f8 => fffffffff5f6f7f8
Mark Wielaard 302637
+mtfprwa: fefdfeff => fffffffffefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+vaddudm: 0102030405060708 @@ 0102030405060708,  ==> 020406080a0c0e10
Mark Wielaard 302637
+	090a0b0c0e0d0e0f @@ 090a0b0c0e0d0e0f,  ==> 121416181c1a1c1e
Mark Wielaard 302637
+vaddudm: 0102030405060708 @@ f1f2f3f4f5f6f7f8,  ==> f2f4f6f8fafcff00
Mark Wielaard 302637
+	090a0b0c0e0d0e0f @@ f9fafbfcfefdfeff,  ==> 030507090d0b0d0e
Mark Wielaard 302637
+vaddudm: f1f2f3f4f5f6f7f8 @@ 0102030405060708,  ==> f2f4f6f8fafcff00
Mark Wielaard 302637
+	f9fafbfcfefdfeff @@ 090a0b0c0e0d0e0f,  ==> 030507090d0b0d0e
Mark Wielaard 302637
+vaddudm: f1f2f3f4f5f6f7f8 @@ f1f2f3f4f5f6f7f8,  ==> e3e5e7e9ebedeff0
Mark Wielaard 302637
+	f9fafbfcfefdfeff @@ f9fafbfcfefdfeff,  ==> f3f5f7f9fdfbfdfe
Mark Wielaard 302637
+
Mark Wielaard 302637
+vpkudum: Inputs: 05060708 0e0d0e0f 05060708 0e0d0e0f
Mark Wielaard 302637
+         Output: 05060708 0e0d0e0f 05060708 0e0d0e0f
Mark Wielaard 302637
+vpkudum: Inputs: 05060708 0e0d0e0f f5f6f7f8 fefdfeff
Mark Wielaard 302637
+         Output: 05060708 0e0d0e0f f5f6f7f8 fefdfeff
Mark Wielaard 302637
+vpkudum: Inputs: f5f6f7f8 fefdfeff 05060708 0e0d0e0f
Mark Wielaard 302637
+         Output: f5f6f7f8 fefdfeff 05060708 0e0d0e0f
Mark Wielaard 302637
+vpkudum: Inputs: f5f6f7f8 fefdfeff f5f6f7f8 fefdfeff
Mark Wielaard 302637
+         Output: f5f6f7f8 fefdfeff f5f6f7f8 fefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+All done. Tested 5 different instructions
Mark Wielaard 302637
diff --git a/none/tests/ppc32/jm_vec_isa_2_07.vgtest b/none/tests/ppc32/jm_vec_isa_2_07.vgtest
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..a93060a
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/jm_vec_isa_2_07.vgtest
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+prereq: ../../../tests/check_isa-2_07_cap
Mark Wielaard 302637
+prog: test_isa_2_07_part1 -a
Mark Wielaard 302637
diff --git a/none/tests/ppc32/test_isa_2_07_part1.c b/none/tests/ppc32/test_isa_2_07_part1.c
Mark Wielaard 302637
new file mode 120000
Mark Wielaard 302637
index 0000000..b258517
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/test_isa_2_07_part1.c
Mark Wielaard 302637
@@ -0,0 +1 @@
Mark Wielaard 302637
+../ppc64/test_isa_2_07_part1.c
Mark Wielaard 302637
\ No newline at end of file
Mark Wielaard 302637
diff --git a/none/tests/ppc32/test_isa_2_07_part2.c b/none/tests/ppc32/test_isa_2_07_part2.c
Mark Wielaard 302637
new file mode 120000
Mark Wielaard 302637
index 0000000..3eb5caf
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/test_isa_2_07_part2.c
Mark Wielaard 302637
@@ -0,0 +1 @@
Mark Wielaard 302637
+../ppc64/test_isa_2_07_part2.c
Mark Wielaard 302637
\ No newline at end of file
Mark Wielaard 302637
diff --git a/none/tests/ppc32/test_isa_2_07_part2.stderr.exp b/none/tests/ppc32/test_isa_2_07_part2.stderr.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..139597f
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/test_isa_2_07_part2.stderr.exp
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
diff --git a/none/tests/ppc32/test_isa_2_07_part2.stdout.exp b/none/tests/ppc32/test_isa_2_07_part2.stdout.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..c65c574
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/test_isa_2_07_part2.stdout.exp
Mark Wielaard 302637
@@ -0,0 +1,44 @@
Mark Wielaard 302637
+Test VSX vector and scalar single argument instructions
Mark Wielaard 302637
+#0: xscvdpspn conv(3fd8000000000000) = 3ec0000000000000
Mark Wielaard 302637
+#1: xscvdpspn conv(404f000000000000) = 4278000000000000
Mark Wielaard 302637
+#2: xscvdpspn conv(0018000000b77501) = 0000000000000000
Mark Wielaard 302637
+#3: xscvdpspn conv(7fe800000000051b) = 7f40000000000000
Mark Wielaard 302637
+#4: xscvdpspn conv(0123214569900000) = 0000000000000000
Mark Wielaard 302637
+#5: xscvdpspn conv(0000000000000000) = 0000000000000000
Mark Wielaard 302637
+#6: xscvdpspn conv(8000000000000000) = 8000000000000000
Mark Wielaard 302637
+#7: xscvdpspn conv(7ff0000000000000) = 7f80000000000000
Mark Wielaard 302637
+#8: xscvdpspn conv(fff0000000000000) = ff80000000000000
Mark Wielaard 302637
+#9: xscvdpspn conv(7ff7ffffffffffff) = 7fbfffff00000000
Mark Wielaard 302637
+#10: xscvdpspn conv(fff7ffffffffffff) = ffbfffff00000000
Mark Wielaard 302637
+#11: xscvdpspn conv(7ff8000000000000) = 7fc0000000000000
Mark Wielaard 302637
+#12: xscvdpspn conv(fff8000000000000) = ffc0000000000000
Mark Wielaard 302637
+#13: xscvdpspn conv(8008340000078000) = 8000000000000000
Mark Wielaard 302637
+#14: xscvdpspn conv(c0d0650f5a07b353) = c683287a00000000
Mark Wielaard 302637
+#15: xscvdpspn conv(41232585a9900000) = 49192c2d00000000
Mark Wielaard 302637
+#16: xscvdpspn conv(41382511a2000000) = 49c1288d00000000
Mark Wielaard 302637
+#17: xscvdpspn conv(40312ef5a9300000) = 418977ad00000000
Mark Wielaard 302637
+#18: xscvdpspn conv(40514bf5d2300000) = 428a5fae00000000
Mark Wielaard 302637
+#19: xscvdpspn conv(40976bf982440000) = 44bb5fcc00000000
Mark Wielaard 302637
+
Mark Wielaard 302637
+#0: xscvspdpn conv(3ec00000) = 3fd8000000000000
Mark Wielaard 302637
+#1: xscvspdpn conv(42780000) = 404f000000000000
Mark Wielaard 302637
+#2: xscvspdpn conv(00000000) = 0000000000000000
Mark Wielaard 302637
+#3: xscvspdpn conv(7f800000) = 7ff0000000000000
Mark Wielaard 302637
+#4: xscvspdpn conv(00000000) = 0000000000000000
Mark Wielaard 302637
+#5: xscvspdpn conv(00000000) = 0000000000000000
Mark Wielaard 302637
+#6: xscvspdpn conv(80000000) = 8000000000000000
Mark Wielaard 302637
+#7: xscvspdpn conv(7f800000) = 7ff0000000000000
Mark Wielaard 302637
+#8: xscvspdpn conv(ff800000) = fff0000000000000
Mark Wielaard 302637
+#9: xscvspdpn conv(7fffffff) = 7fffffffe0000000
Mark Wielaard 302637
+#10: xscvspdpn conv(ffffffff) = ffffffffe0000000
Mark Wielaard 302637
+#11: xscvspdpn conv(7fc00000) = 7ff8000000000000
Mark Wielaard 302637
+#12: xscvspdpn conv(ffc00000) = fff8000000000000
Mark Wielaard 302637
+#13: xscvspdpn conv(80000000) = 8000000000000000
Mark Wielaard 302637
+#14: xscvspdpn conv(c683287b) = c0d0650f60000000
Mark Wielaard 302637
+#15: xscvspdpn conv(49192c2d) = 41232585a0000000
Mark Wielaard 302637
+#16: xscvspdpn conv(49c1288d) = 41382511a0000000
Mark Wielaard 302637
+#17: xscvspdpn conv(418977ad) = 40312ef5a0000000
Mark Wielaard 302637
+#18: xscvspdpn conv(428a5faf) = 40514bf5e0000000
Mark Wielaard 302637
+#19: xscvspdpn conv(44bb5fcc) = 40976bf980000000
Mark Wielaard 302637
+
Mark Wielaard 302637
+Testcase PASSED
Mark Wielaard 302637
diff --git a/none/tests/ppc32/test_isa_2_07_part2.vgtest b/none/tests/ppc32/test_isa_2_07_part2.vgtest
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..a4649be
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc32/test_isa_2_07_part2.vgtest
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+prereq: ../../../tests/check_isa-2_07_cap
Mark Wielaard 302637
+prog: test_isa_2_07_part2
Mark Wielaard 302637
diff --git a/none/tests/ppc64/jm_vec_isa_2_07.stderr.exp b/none/tests/ppc64/jm_vec_isa_2_07.stderr.exp
Mark Wielaard befc2c
new file mode 100755
Mark Wielaard 302637
index 0000000..139597f
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/jm_vec_isa_2_07.stderr.exp
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
diff --git a/none/tests/ppc64/jm_vec_isa_2_07.stdout.exp b/none/tests/ppc64/jm_vec_isa_2_07.stdout.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..2568739
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/jm_vec_isa_2_07.stdout.exp
Mark Wielaard 302637
@@ -0,0 +1,34 @@
Mark Wielaard 302637
+mfvsrd: 0102030405060708 => 0102030405060708
Mark Wielaard 302637
+mfvsrd: 090a0b0c0e0d0e0f => 090a0b0c0e0d0e0f
Mark Wielaard 302637
+mfvsrd: f1f2f3f4f5f6f7f8 => f1f2f3f4f5f6f7f8
Mark Wielaard 302637
+mfvsrd: f9fafbfcfefdfeff => f9fafbfcfefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+mtvsrd: 0102030405060708 => 0102030405060708
Mark Wielaard 302637
+mtvsrd: 090a0b0c0e0d0e0f => 090a0b0c0e0d0e0f
Mark Wielaard 302637
+mtvsrd: f1f2f3f4f5f6f7f8 => f1f2f3f4f5f6f7f8
Mark Wielaard 302637
+mtvsrd: f9fafbfcfefdfeff => f9fafbfcfefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+mtfprwa: 05060708 => 0000000005060708
Mark Wielaard 302637
+mtfprwa: 0e0d0e0f => 000000000e0d0e0f
Mark Wielaard 302637
+mtfprwa: f5f6f7f8 => fffffffff5f6f7f8
Mark Wielaard 302637
+mtfprwa: fefdfeff => fffffffffefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+vaddudm: 0102030405060708 @@ 0102030405060708,  ==> 020406080a0c0e10
Mark Wielaard 302637
+	090a0b0c0e0d0e0f @@ 090a0b0c0e0d0e0f,  ==> 121416181c1a1c1e
Mark Wielaard 302637
+vaddudm: 0102030405060708 @@ f1f2f3f4f5f6f7f8,  ==> f2f4f6f8fafcff00
Mark Wielaard 302637
+	090a0b0c0e0d0e0f @@ f9fafbfcfefdfeff,  ==> 030507090d0b0d0e
Mark Wielaard 302637
+vaddudm: f1f2f3f4f5f6f7f8 @@ 0102030405060708,  ==> f2f4f6f8fafcff00
Mark Wielaard 302637
+	f9fafbfcfefdfeff @@ 090a0b0c0e0d0e0f,  ==> 030507090d0b0d0e
Mark Wielaard 302637
+vaddudm: f1f2f3f4f5f6f7f8 @@ f1f2f3f4f5f6f7f8,  ==> e3e5e7e9ebedeff0
Mark Wielaard 302637
+	f9fafbfcfefdfeff @@ f9fafbfcfefdfeff,  ==> f3f5f7f9fdfbfdfe
Mark Wielaard 302637
+
Mark Wielaard 302637
+vpkudum: Inputs: 05060708 0e0d0e0f 05060708 0e0d0e0f
Mark Wielaard 302637
+         Output: 05060708 0e0d0e0f 05060708 0e0d0e0f
Mark Wielaard 302637
+vpkudum: Inputs: 05060708 0e0d0e0f f5f6f7f8 fefdfeff
Mark Wielaard 302637
+         Output: 05060708 0e0d0e0f f5f6f7f8 fefdfeff
Mark Wielaard 302637
+vpkudum: Inputs: f5f6f7f8 fefdfeff 05060708 0e0d0e0f
Mark Wielaard 302637
+         Output: f5f6f7f8 fefdfeff 05060708 0e0d0e0f
Mark Wielaard 302637
+vpkudum: Inputs: f5f6f7f8 fefdfeff f5f6f7f8 fefdfeff
Mark Wielaard 302637
+         Output: f5f6f7f8 fefdfeff f5f6f7f8 fefdfeff
Mark Wielaard 302637
+
Mark Wielaard 302637
+All done. Tested 5 different instructions
Mark Wielaard 302637
diff --git a/none/tests/ppc64/jm_vec_isa_2_07.vgtest b/none/tests/ppc64/jm_vec_isa_2_07.vgtest
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..a93060a
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/jm_vec_isa_2_07.vgtest
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+prereq: ../../../tests/check_isa-2_07_cap
Mark Wielaard 302637
+prog: test_isa_2_07_part1 -a
Mark Wielaard 302637
diff --git a/none/tests/ppc64/test_isa_2_07_part1.c b/none/tests/ppc64/test_isa_2_07_part1.c
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..8606c62
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/test_isa_2_07_part1.c
Mark Wielaard 302637
@@ -0,0 +1,746 @@
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* HOW TO COMPILE:
Mark Wielaard 302637
+
Mark Wielaard 302637
+ * 32bit build:
Mark Wielaard 302637
+   gcc -Winline -Wall -g -O -mregnames -maltivec
Mark Wielaard 302637
+ * 64bit build:
Mark Wielaard 302637
+   gcc -Winline -Wall -g -O -mregnames -maltivec -m64
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+ * jm_insns_isa_2_07.c:
Mark Wielaard 302637
+ * PPC tests for the ISA 2.07.  This file is based on the
Mark Wielaard 302637
+ * jm-insns.c file for the new instructions in the ISA 2.07.  The
Mark Wielaard 302637
+ * test structure has been kept the same as the original file to
Mark Wielaard 302637
+ * the extent possible.
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ * Copyright (C) 2013 IBM
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *   Authors: Carl Love <carll@us.ibm.com>
Mark Wielaard 302637
+ *            Maynard Johnson <maynardj@us.ibm.com>
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *   This program is free software; you can redistribute it and/or
Mark Wielaard 302637
+ *   modify it under the terms of the GNU General Public License as
Mark Wielaard 302637
+ *   published by the Free Software Foundation; either version 2 of the
Mark Wielaard 302637
+ *   License, or (at your option) any later version.
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *   This program is distributed in the hope that it will be useful,
Mark Wielaard 302637
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Mark Wielaard 302637
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Mark Wielaard 302637
+ *   GNU General Public License for more details.
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *   You should have received a copy of the GNU General Public License
Mark Wielaard 302637
+ *   along with this program; if not, write to the Free Software
Mark Wielaard 302637
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ */
Mark Wielaard 302637
+
Mark Wielaard 302637
+/*
Mark Wielaard 302637
+ * Operation details
Mark Wielaard 302637
+ * -----------------
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ * The 'loops' (e.g. int_loops) do the actual work:
Mark Wielaard 302637
+ *  - loops over as many arguments as the insn needs (regs | imms)
Mark Wielaard 302637
+ *     - sets up the environment (reset cr,xer, assign src regs...)
Mark Wielaard 302637
+ *     - maybe modifies the asm instn to test different imm args
Mark Wielaard 302637
+ *     - calls the test function
Mark Wielaard 302637
+ *     - retrieves relevant register data (rD,cr,xer,...)
Mark Wielaard 302637
+ *     - prints argument and result data.
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ * More specifically...
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ * all_tests[i] holds insn tests
Mark Wielaard 302637
+ *  - of which each holds: {instn_test_arr[], description, flags}
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ * flags hold 3 instn classifiers: {family, type, arg_type}
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ * // The main test loop:
Mark Wielaard 302637
+ * do_tests( user_ctl_flags ) {
Mark Wielaard 302637
+ *    foreach(curr_test = all_test[i]) {
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *       // flags are used to control what tests are run:
Mark Wielaard 302637
+ *       if (curr_test->flags && !user_ctl_flags)
Mark Wielaard 302637
+ *          continue;
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *       // a 'loop_family_arr' is chosen based on the 'family' flag...
Mark Wielaard 302637
+ *       switch(curr_test->flags->family) {
Mark Wielaard 302637
+ *       case x: loop_family_arr = int_loops;
Mark Wielaard 302637
+ *      ...
Mark Wielaard 302637
+ *       }
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *       // ...and the actual test_loop to run is found by indexing into
Mark Wielaard 302637
+ *       // the loop_family_arr with the 'arg_type' flag:
Mark Wielaard 302637
+ *       test_loop = loop_family[curr_test->flags->arg_type]
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *       // finally, loop over all instn tests for this test:
Mark Wielaard 302637
+ *       foreach (instn_test = curr_test->instn_test_arr[i]) {
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ *          // and call the test_loop with the current instn_test function,name
Mark Wielaard 302637
+ *          test_loop( instn_test->func, instn_test->name )
Mark Wielaard 302637
+ *       }
Mark Wielaard 302637
+ *    }
Mark Wielaard 302637
+ * }
Mark Wielaard 302637
+ *
Mark Wielaard 302637
+ */
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+/**********************************************************************/
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* Uncomment to enable output of CR flags for float tests */
Mark Wielaard 302637
+//#define TEST_FLOAT_FLAGS
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* Uncomment to enable debug output */
Mark Wielaard 302637
+//#define DEBUG_ARGS_BUILD
Mark Wielaard 302637
+//#define DEBUG_FILTER
Mark Wielaard 302637
+
Mark Wielaard 302637
+/**********************************************************************/
Mark Wielaard 302637
+#include <stdio.h>
Mark Wielaard 302637
+
Mark Wielaard 302637
+#ifdef HAS_ISA_2_07
Mark Wielaard 302637
+
Mark Wielaard 302637
+#include "config.h"
Mark Wielaard 302637
+#include <altivec.h>
Mark Wielaard 302637
+#include <stdint.h>
Mark Wielaard 302637
+
Mark Wielaard 302637
+#include <assert.h>
Mark Wielaard 302637
+#include <ctype.h>     // isspace
Mark Wielaard 302637
+#include <stdlib.h>
Mark Wielaard 302637
+#include <string.h>
Mark Wielaard 302637
+#include <unistd.h>    // getopt
Mark Wielaard 302637
+
Mark Wielaard 302637
+#if !defined (__TEST_PPC_H__)
Mark Wielaard 302637
+#define __TEST_PPC_H__
Mark Wielaard 302637
+
Mark Wielaard 302637
+#include "tests/sys_mman.h"
Mark Wielaard 302637
+#include "tests/malloc.h"       // memalign16
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define STATIC_ASSERT(e) sizeof(struct { int:-!(e); })
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* Something of the same size as void*, so can be safely be coerced
Mark Wielaard 302637
+ * to/from a pointer type. Also same size as the host's gp registers.
Mark Wielaard 302637
+ * According to the AltiVec section of the GCC manual, the syntax does
Mark Wielaard 302637
+ * not allow the use of a typedef name as a type specifier in conjunction
Mark Wielaard 302637
+ * with the vector keyword, so typedefs uint[32|64]_t are #undef'ed here
Mark Wielaard 302637
+ * and redefined using #define.
Mark Wielaard 302637
+ */
Mark Wielaard 302637
+#undef uint32_t
Mark Wielaard 302637
+#undef uint64_t
Mark Wielaard 302637
+#define uint32_t unsigned int
Mark Wielaard 302637
+#define uint64_t unsigned long long int
Mark Wielaard 302637
+
Mark Wielaard 302637
+#ifndef __powerpc64__
Mark Wielaard 302637
+typedef uint32_t  HWord_t;
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+typedef uint64_t  HWord_t;
Mark Wielaard 302637
+#endif /* __powerpc64__ */
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef uint64_t Word_t;
Mark Wielaard 302637
+
Mark Wielaard 302637
+enum {
Mark Wielaard 302637
+    compile_time_test1 = STATIC_ASSERT(sizeof(uint32_t) == 4),
Mark Wielaard 302637
+    compile_time_test2 = STATIC_ASSERT(sizeof(uint64_t) == 8),
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define ALLCR "cr0","cr1","cr2","cr3","cr4","cr5","cr6","cr7"
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_CR(_arg) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mtcr  %0" : : "b"(_arg) : ALLCR );
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_XER(_arg) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mtxer %0" : : "b"(_arg) : "xer" );
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define GET_CR(_lval) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mfcr %0"  : "=b"(_lval) )
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define GET_XER(_lval) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mfxer %0" : "=b"(_lval) )
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define GET_CR_XER(_lval_cr,_lval_xer) \
Mark Wielaard 302637
+   do { GET_CR(_lval_cr); GET_XER(_lval_xer); } while (0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_CR_ZERO \
Mark Wielaard 302637
+      SET_CR(0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_XER_ZERO \
Mark Wielaard 302637
+      SET_XER(0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_CR_XER_ZERO \
Mark Wielaard 302637
+   do { SET_CR_ZERO; SET_XER_ZERO; } while (0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_FPSCR_ZERO \
Mark Wielaard 302637
+   do { double _d = 0.0; \
Mark Wielaard 302637
+        __asm__ __volatile__ ("mtfsf 0xFF, %0" : : "f"(_d) ); \
Mark Wielaard 302637
+   } while (0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define DEFAULT_VSCR 0x0
Mark Wielaard 302637
+
Mark Wielaard 302637
+static vector unsigned long long vec_out, vec_inA, vec_inB;
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* XXXX these must all be callee-save regs! */
Mark Wielaard 302637
+register double f14 __asm__ ("fr14");
Mark Wielaard 302637
+register double f15 __asm__ ("fr15");
Mark Wielaard 302637
+register double f16 __asm__ ("fr16");
Mark Wielaard 302637
+register double f17 __asm__ ("fr17");
Mark Wielaard 302637
+register HWord_t r14 __asm__ ("r14");
Mark Wielaard 302637
+register HWord_t r17 __asm__ ("r17");
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef void (*test_func_t) (void);
Mark Wielaard 302637
+typedef struct _test test_t;
Mark Wielaard 302637
+typedef struct _test_table test_table_t;
Mark Wielaard 302637
+struct _test {
Mark Wielaard 302637
+    test_func_t func;
Mark Wielaard 302637
+    const char *name;
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+struct _test_table {
Mark Wielaard 302637
+    test_t *tests;
Mark Wielaard 302637
+    const char *name;
Mark Wielaard 302637
+    uint32_t flags;
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef void (*test_loop_t) (const char *name, test_func_t func,
Mark Wielaard 302637
+                             uint32_t flags);
Mark Wielaard 302637
+
Mark Wielaard 302637
+enum test_flags {
Mark Wielaard 302637
+    /* Nb arguments */
Mark Wielaard 302637
+    PPC_ONE_ARG    = 0x00000001,
Mark Wielaard 302637
+    PPC_TWO_ARGS   = 0x00000002,
Mark Wielaard 302637
+    PPC_THREE_ARGS = 0x00000003,
Mark Wielaard 302637
+    PPC_CMP_ARGS   = 0x00000004,  // family: compare
Mark Wielaard 302637
+    PPC_CMPI_ARGS  = 0x00000005,  // family: compare
Mark Wielaard 302637
+    PPC_TWO_I16    = 0x00000006,  // family: arith/logical
Mark Wielaard 302637
+    PPC_SPECIAL    = 0x00000007,  // family: logical
Mark Wielaard 302637
+    PPC_LD_ARGS    = 0x00000008,  // family: ldst
Mark Wielaard 302637
+    PPC_LDX_ARGS   = 0x00000009,  // family: ldst
Mark Wielaard 302637
+    PPC_ST_ARGS    = 0x0000000A,  // family: ldst
Mark Wielaard 302637
+    PPC_STX_ARGS   = 0x0000000B,  // family: ldst
Mark Wielaard 302637
+    PPC_STQ_ARGS   = 0x0000000C,  // family: ldst, two args, imm
Mark Wielaard 302637
+    PPC_LDQ_ARGS   = 0x0000000D,  // family: ldst, two args, imm
Mark Wielaard 302637
+    PPC_STQX_ARGS  = 0x0000000E,  // family: ldst, three args
Mark Wielaard 302637
+    PPC_LDQX_ARGS  = 0x0000000F,  // family: ldst, three_args
Mark Wielaard 302637
+    PPC_NB_ARGS    = 0x0000000F,
Mark Wielaard 302637
+    /* Type */
Mark Wielaard 302637
+    PPC_ARITH      = 0x00000100,
Mark Wielaard 302637
+    PPC_LOGICAL    = 0x00000200,
Mark Wielaard 302637
+    PPC_COMPARE    = 0x00000300,
Mark Wielaard 302637
+    PPC_CROP       = 0x00000400,
Mark Wielaard 302637
+    PPC_LDST       = 0x00000500,
Mark Wielaard 302637
+    PPC_POPCNT     = 0x00000600,
Mark Wielaard 302637
+    PPC_MOV        = 0x00000A00,
Mark Wielaard 302637
+    PPC_TYPE       = 0x00000F00,
Mark Wielaard 302637
+    /* Family */
Mark Wielaard 302637
+    PPC_INTEGER    = 0x00010000,
Mark Wielaard 302637
+    PPC_FLOAT      = 0x00020000,
Mark Wielaard 302637
+    PPC_405        = 0x00030000,  // Leave so we keep numbering consistent
Mark Wielaard 302637
+    PPC_ALTIVEC    = 0x00040000,
Mark Wielaard 302637
+    PPC_FALTIVEC   = 0x00050000,
Mark Wielaard 302637
+    PPC_FAMILY     = 0x000F0000,
Mark Wielaard 302637
+    /* Flags: these may be combined, so use separate bitfields. */
Mark Wielaard 302637
+    PPC_CR         = 0x01000000,
Mark Wielaard 302637
+    PPC_XER_CA     = 0x02000000,
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+#endif /* !defined (__TEST_PPC_H__) */
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* -------------- END #include "test-ppc.h" -------------- */
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+#if defined (DEBUG_ARGS_BUILD)
Mark Wielaard 302637
+#define AB_DPRINTF(fmt, args...) do { fprintf(stderr, fmt , ##args); } while (0)
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+#define AB_DPRINTF(fmt, args...) do { } while (0)
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+
Mark Wielaard 302637
+#if defined (DEBUG_FILTER)
Mark Wielaard 302637
+#define FDPRINTF(fmt, args...) do { fprintf(stderr, fmt , ##args); } while (0)
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+#define FDPRINTF(fmt, args...) do { } while (0)
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define unused __attribute__ (( unused ))
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef struct special {
Mark Wielaard 302637
+   const char *name;
Mark Wielaard 302637
+   void (*test_cb)(const char* name, test_func_t func,
Mark Wielaard 302637
+                   unused uint32_t test_flags);
Mark Wielaard 302637
+} special_t;
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+// VSX move instructions
Mark Wielaard 302637
+static void test_mfvsrd (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("mfvsrd %0,%x1" : "=r" (r14) : "ws" (vec_inA));
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_mtvsrd (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("mtvsrd %x0,%1" : "=ws" (vec_out) : "r" (r14));
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_mtfprwa (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("mtfprwa %x0,%1" : "=ws" (vec_out) : "r" (r14));
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static test_t tests_move_ops_spe[] = {
Mark Wielaard 302637
+  { &test_mfvsrd          , "mfvsrd" },
Mark Wielaard 302637
+  { &test_mtvsrd          , "mtvsrd" },
Mark Wielaard 302637
+  { &test_mtfprwa         , "mtfprwa" },
Mark Wielaard 302637
+  { NULL,                   NULL }
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* Vector Double Word tests.
Mark Wielaard 302637
+ * NOTE: Since these are "vector" instructions versus VSX, we must use
Mark Wielaard 302637
+ * vector constraints. */
Mark Wielaard 302637
+static void test_vaddudm (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("vaddudm %0, %1, %2" : "=v" (vec_out): "v" (vec_inA),"v" (vec_inB));
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_vpkudum (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("vpkudum %0, %1, %2" : "=v" (vec_out): "v" (vec_inA),"v" (vec_inB));
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static test_t tests_aa_dbl_ops_two[] = {
Mark Wielaard 302637
+  { &test_vaddudm         , "vaddudm", },
Mark Wielaard 302637
+  { &test_vpkudum         , "vpkudum",  },
Mark Wielaard 302637
+  { NULL,                   NULL,           },
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static int verbose = 0;
Mark Wielaard 302637
+static int arg_list_size = 0;
Mark Wielaard 302637
+static unsigned long long * vdargs = NULL;
Mark Wielaard 302637
+#define NB_VDARGS 4
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void build_vdargs_table (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   // Each VSX register holds two doubleword integer values
Mark Wielaard 302637
+   vdargs = memalign16(NB_VDARGS * sizeof(unsigned long long));
Mark Wielaard 302637
+   vdargs[0] = 0x0102030405060708ULL;
Mark Wielaard 302637
+   vdargs[1] = 0x090A0B0C0E0D0E0FULL;
Mark Wielaard 302637
+   vdargs[2] = 0xF1F2F3F4F5F6F7F8ULL;
Mark Wielaard 302637
+   vdargs[3] = 0xF9FAFBFCFEFDFEFFULL;
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static int check_filter (char *filter)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   char *c;
Mark Wielaard 302637
+   int ret = 1;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   if (filter != NULL) {
Mark Wielaard 302637
+      c = strchr(filter, '*');
Mark Wielaard 302637
+      if (c != NULL) {
Mark Wielaard 302637
+         *c = '\0';
Mark Wielaard 302637
+         ret = 0;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+   return ret;
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static int check_name (const char* name, const char *filter,
Mark Wielaard 302637
+                       int exact)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   int nlen, flen;
Mark Wielaard 302637
+   int ret = 0;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   if (filter != NULL) {
Mark Wielaard 302637
+      for (; isspace(*name); name++)
Mark Wielaard 302637
+         continue;
Mark Wielaard 302637
+      FDPRINTF("Check '%s' againt '%s' (%s match)\n",
Mark Wielaard 302637
+               name, filter, exact ? "exact" : "starting");
Mark Wielaard 302637
+      nlen = strlen(name);
Mark Wielaard 302637
+      flen = strlen(filter);
Mark Wielaard 302637
+      if (exact) {
Mark Wielaard 302637
+         if (nlen == flen && memcmp(name, filter, flen) == 0)
Mark Wielaard 302637
+            ret = 1;
Mark Wielaard 302637
+      } else {
Mark Wielaard 302637
+         if (flen <= nlen && memcmp(name, filter, flen) == 0)
Mark Wielaard 302637
+            ret = 1;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+   } else {
Mark Wielaard 302637
+      ret = 1;
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+   return ret;
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef struct insn_sel_flags_t_struct {
Mark Wielaard 302637
+   int one_arg, two_args, three_args;
Mark Wielaard 302637
+   int arith, logical, compare, ldst;
Mark Wielaard 302637
+   int integer, floats, altivec, faltivec;
Mark Wielaard 302637
+   int cr;
Mark Wielaard 302637
+} insn_sel_flags_t;
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void mfvs(const char* name, test_func_t func,
Mark Wielaard 302637
+                 unused uint32_t test_flags)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   /* This test is for move instructions where the input is a scalar register
Mark Wielaard 302637
+    * and the destination is a vector register.
Mark Wielaard 302637
+    */
Mark Wielaard 302637
+   int i;
Mark Wielaard 302637
+   volatile Word_t result;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   for (i=0; i < NB_VDARGS; i++) {
Mark Wielaard 302637
+      r14 = 0ULL;
Mark Wielaard 302637
+      vec_inA = (vector unsigned long long){ vdargs[i], 0ULL };
Mark Wielaard 302637
+
Mark Wielaard 302637
+      (*func)();
Mark Wielaard 302637
+      result = r14;
Mark Wielaard 302637
+      printf("%s: %016llx => %016llx\n", name, vdargs[i], result);
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void mtvs(const char* name, test_func_t func,
Mark Wielaard 302637
+                 unused uint32_t test_flags)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   /* This test is for move instructions where the input is a scalar register
Mark Wielaard 302637
+    * and the destination is a vector register.
Mark Wielaard 302637
+    */
Mark Wielaard 302637
+   unsigned long long *dst;
Mark Wielaard 302637
+   int i;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   for (i=0; i < NB_VDARGS; i++) {
Mark Wielaard 302637
+      r14  = vdargs[i];
Mark Wielaard 302637
+      vec_out = (vector unsigned long long){ 0ULL, 0ULL };
Mark Wielaard 302637
+
Mark Wielaard 302637
+      (*func)();
Mark Wielaard 302637
+      dst = (unsigned long long *) &vec_out;
Mark Wielaard 302637
+      printf("%s: %016llx => %016llx\n", name, vdargs[i], *dst);
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void mtvs2s(const char* name, test_func_t func,
Mark Wielaard 302637
+                 unused uint32_t test_flags)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   /* This test is the mtvsrwa instruction.
Mark Wielaard 302637
+    */
Mark Wielaard 302637
+   unsigned long long *dst;
Mark Wielaard 302637
+   int i;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   for (i=0; i < NB_VDARGS; i++) {
Mark Wielaard 302637
+      // Only the lower half of the vdarg doubleword arg will be used as input by mtvsrwa
Mark Wielaard 302637
+      unsigned int * src = (unsigned int *)&vdargs[i];
Mark Wielaard 302637
+      src++;
Mark Wielaard 302637
+      r14  = vdargs[i];
Mark Wielaard 302637
+      vec_out = (vector unsigned long long){ 0ULL, 0ULL };
Mark Wielaard 302637
+
Mark Wielaard 302637
+      (*func)();
Mark Wielaard 302637
+      // Only doubleword 0 is used in output
Mark Wielaard 302637
+      dst = (unsigned long long *) &vec_out;
Mark Wielaard 302637
+      printf("%s: %08x => %016llx\n", name, *src, *dst);
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_special (special_t *table,
Mark Wielaard 302637
+                          const char* name, test_func_t func,
Mark Wielaard 302637
+                          unused uint32_t test_flags)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   const char *tmp;
Mark Wielaard 302637
+   int i;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   for (tmp = name; isspace(*tmp); tmp++)
Mark Wielaard 302637
+      continue;
Mark Wielaard 302637
+   for (i=0; table[i].name != NULL; i++) {
Mark Wielaard 302637
+      if (strcmp(table[i].name, tmp) == 0) {
Mark Wielaard 302637
+         (*table[i].test_cb)(name, func, test_flags);
Mark Wielaard 302637
+         return;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+   fprintf(stderr, "ERROR: no test found for op '%s'\n", name);
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static special_t special_move_ops[] = {
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+      "mfvsrd",  /* move from vector to scalar reg */
Mark Wielaard 302637
+      &mfvs,
Mark Wielaard 302637
+   },
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+      "mtvsrd",  /* move from scalar to vector reg */
Mark Wielaard 302637
+      &mtvs,
Mark Wielaard 302637
+   },
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+      "mtfprwa", /* (extended mnemonic for mtvsrwa) move from scalar to vector reg with two’s-complement */
Mark Wielaard 302637
+      &mtvs2s,
Mark Wielaard 302637
+   },
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_move_special(const char* name, test_func_t func,
Mark Wielaard 302637
+                                uint32_t test_flags)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   test_special(special_move_ops, name, func, test_flags);
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* Vector Double Word tests */
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_av_dint_two_args (const char* name, test_func_t func,
Mark Wielaard 302637
+                                   unused uint32_t test_flags)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+
Mark Wielaard 302637
+   unsigned long long * dst;
Mark Wielaard 302637
+   unsigned int * dst_int;
Mark Wielaard 302637
+   int i,j;
Mark Wielaard 302637
+   int is_vpkudum;
Mark Wielaard 302637
+   if (strcmp(name, "vpkudum") == 0)
Mark Wielaard 302637
+      is_vpkudum = 1;
Mark Wielaard 302637
+   else
Mark Wielaard 302637
+      is_vpkudum = 0;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   for (i = 0; i < NB_VDARGS; i+=2) {
Mark Wielaard 302637
+      vec_inA = (vector unsigned long long){ vdargs[i], vdargs[i+1] };
Mark Wielaard 302637
+      for (j = 0; j < NB_VDARGS; j+=2) {
Mark Wielaard 302637
+         vec_inB = (vector unsigned long long){ vdargs[j], vdargs[j+1] };
Mark Wielaard 302637
+         vec_out = (vector unsigned long long){ 0,0 };
Mark Wielaard 302637
+
Mark Wielaard 302637
+         (*func)();
Mark Wielaard 302637
+         dst_int = (unsigned int *)&vec_out;
Mark Wielaard 302637
+         dst  = (unsigned long long*)&vec_out;
Mark Wielaard 302637
+
Mark Wielaard 302637
+         printf("%s: ", name);
Mark Wielaard 302637
+
Mark Wielaard 302637
+         if (is_vpkudum) {
Mark Wielaard 302637
+            printf("Inputs: %08llx %08llx %08llx %08llx\n", vdargs[i] & 0x00000000ffffffffULL,
Mark Wielaard 302637
+                   vdargs[i+1] & 0x00000000ffffffffULL, vdargs[j] & 0x00000000ffffffffULL,
Mark Wielaard 302637
+                   vdargs[j+1] & 0x00000000ffffffffULL);
Mark Wielaard 302637
+            printf("         Output: %08x %08x %08x %08x\n", dst_int[0], dst_int[1],
Mark Wielaard 302637
+                   dst_int[2], dst_int[3]);
Mark Wielaard 302637
+         } else {
Mark Wielaard 302637
+            printf("%016llx @@ %016llx, ", vdargs[i], vdargs[j]);
Mark Wielaard 302637
+            printf(" ==> %016llx\n", dst[0]);
Mark Wielaard 302637
+            printf("\t%016llx @@ %016llx, ", vdargs[i+1], vdargs[j+1]);
Mark Wielaard 302637
+            printf(" ==> %016llx\n", dst[1]);
Mark Wielaard 302637
+         }
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* Used in do_tests, indexed by flags->nb_args
Mark Wielaard 302637
+   Elements correspond to enum test_flags::num args
Mark Wielaard 302637
+*/
Mark Wielaard 302637
+static test_loop_t altivec_mov_loops[] = {
Mark Wielaard 302637
+   &test_move_special,
Mark Wielaard 302637
+   NULL
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static test_loop_t altivec_dint_loops[] = {
Mark Wielaard 302637
+   &test_av_dint_two_args,
Mark Wielaard 302637
+   NULL
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static test_table_t all_tests[] = {
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+       tests_move_ops_spe,
Mark Wielaard 302637
+       "PPC VSR special move insns",
Mark Wielaard 302637
+       PPC_ALTIVEC | PPC_MOV | PPC_ONE_ARG,
Mark Wielaard 302637
+   },
Mark Wielaard 302637
+   {
Mark Wielaard 302637
+       tests_aa_dbl_ops_two,
Mark Wielaard 302637
+       "PC altivec double word integer insns with two args",
Mark Wielaard 302637
+       PPC_ALTIVEC | PPC_ARITH | PPC_TWO_ARGS,
Mark Wielaard 302637
+   },
Mark Wielaard 302637
+   { NULL,                   NULL,               0x00000000, },
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void do_tests ( insn_sel_flags_t seln_flags,
Mark Wielaard 302637
+                       char *filter)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   test_loop_t *loop;
Mark Wielaard 302637
+   test_t *tests;
Mark Wielaard 302637
+   int nb_args, type, family;
Mark Wielaard 302637
+   int i, j, n;
Mark Wielaard 302637
+   int exact;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   exact = check_filter(filter);
Mark Wielaard 302637
+   n = 0;
Mark Wielaard 302637
+   for (i=0; all_tests[i].name != NULL; i++) {
Mark Wielaard 302637
+      nb_args = all_tests[i].flags & PPC_NB_ARGS;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      /* Check number of arguments */
Mark Wielaard 302637
+      if ((nb_args == 1 && !seln_flags.one_arg) ||
Mark Wielaard 302637
+          (nb_args == 2 && !seln_flags.two_args) ||
Mark Wielaard 302637
+          (nb_args == 3 && !seln_flags.three_args)){
Mark Wielaard 302637
+         continue;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+      /* Check instruction type */
Mark Wielaard 302637
+      type = all_tests[i].flags & PPC_TYPE;
Mark Wielaard 302637
+      if ((type == PPC_ARITH   && !seln_flags.arith)   ||
Mark Wielaard 302637
+          (type == PPC_LOGICAL && !seln_flags.logical) ||
Mark Wielaard 302637
+          (type == PPC_COMPARE && !seln_flags.compare) ||
Mark Wielaard 302637
+          (type == PPC_LDST && !seln_flags.ldst)       ||
Mark Wielaard 302637
+          (type == PPC_MOV && !seln_flags.ldst)       ||
Mark Wielaard 302637
+          (type == PPC_POPCNT && !seln_flags.arith)) {
Mark Wielaard 302637
+         continue;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+
Mark Wielaard 302637
+      /* Check instruction family */
Mark Wielaard 302637
+      family = all_tests[i].flags & PPC_FAMILY;
Mark Wielaard 302637
+      if ((family == PPC_INTEGER  && !seln_flags.integer) ||
Mark Wielaard 302637
+          (family == PPC_FLOAT    && !seln_flags.floats)  ||
Mark Wielaard 302637
+          (family == PPC_ALTIVEC && !seln_flags.altivec)  ||
Mark Wielaard 302637
+          (family == PPC_FALTIVEC && !seln_flags.faltivec)) {
Mark Wielaard 302637
+         continue;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+      /* Check flags update */
Mark Wielaard 302637
+      if (((all_tests[i].flags & PPC_CR)  && seln_flags.cr == 0) ||
Mark Wielaard 302637
+          (!(all_tests[i].flags & PPC_CR) && seln_flags.cr == 1))
Mark Wielaard 302637
+         continue;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      /* All passed, do the tests */
Mark Wielaard 302637
+      tests = all_tests[i].tests;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      loop = NULL;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      /* Select the test loop */
Mark Wielaard 302637
+      switch (family) {
Mark Wielaard 302637
+      case PPC_INTEGER:
Mark Wielaard 302637
+         printf("Currently there are no integer tests enabled in this testsuite.\n");
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      case PPC_FLOAT:
Mark Wielaard 302637
+         printf("Currently there are no float tests enabled in this testsuite.\n");
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      case PPC_ALTIVEC:
Mark Wielaard 302637
+         switch (type) {
Mark Wielaard 302637
+            case PPC_MOV:
Mark Wielaard 302637
+               loop = &altivec_mov_loops[0];
Mark Wielaard 302637
+               break;
Mark Wielaard 302637
+            case PPC_ARITH:
Mark Wielaard 302637
+               loop = &altivec_dint_loops[0];
Mark Wielaard 302637
+               break;
Mark Wielaard 302637
+            default:
Mark Wielaard 302637
+               printf("No altivec test defined for type %x\n", type);
Mark Wielaard 302637
+         }
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      case PPC_FALTIVEC:
Mark Wielaard 302637
+         printf("Currently there are no floating altivec tests in this testsuite.\n");
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      default:
Mark Wielaard 302637
+         printf("ERROR: unknown insn family %08x\n", family);
Mark Wielaard 302637
+         continue;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+      if (1 || verbose > 0)
Mark Wielaard 302637
+      for (j=0; tests[j].name != NULL; j++) {
Mark Wielaard 302637
+         if (check_name(tests[j].name, filter, exact)) {
Mark Wielaard 302637
+            if (verbose > 1)
Mark Wielaard 302637
+               printf("Test instruction %s\n", tests[j].name);
Mark Wielaard 302637
+            if (loop != NULL)
Mark Wielaard 302637
+               (*loop)(tests[j].name, tests[j].func, all_tests[i].flags);
Mark Wielaard 302637
+            printf("\n");
Mark Wielaard 302637
+            n++;
Mark Wielaard 302637
+         }
Mark Wielaard 302637
+        }
Mark Wielaard 302637
+      if (verbose) printf("\n");
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+   printf("All done. Tested %d different instructions\n", n);
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void usage (void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   fprintf(stderr,
Mark Wielaard 302637
+           "Usage: jm-insns [OPTION]\n"
Mark Wielaard 302637
+           "\t-i: test integer instructions (default)\n"
Mark Wielaard 302637
+           "\t-f: test floating point instructions\n"
Mark Wielaard 302637
+           "\t-a: test altivec instructions\n"
Mark Wielaard 302637
+           "\t-A: test all (int, fp, altivec) instructions\n"
Mark Wielaard 302637
+           "\t-v: be verbose\n"
Mark Wielaard 302637
+           "\t-h: display this help and exit\n"
Mark Wielaard 302637
+           );
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+
Mark Wielaard 302637
+int main (int argc, char **argv)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+#ifdef HAS_ISA_2_07
Mark Wielaard 302637
+   /* Simple usage:
Mark Wielaard 302637
+      ./jm-insns -i   => int insns
Mark Wielaard 302637
+      ./jm-insns -f   => fp  insns
Mark Wielaard 302637
+      ./jm-insns -a   => av  insns
Mark Wielaard 302637
+      ./jm-insns -A   => int, fp and avinsns
Mark Wielaard 302637
+   */
Mark Wielaard 302637
+   char *filter = NULL;
Mark Wielaard 302637
+   insn_sel_flags_t flags;
Mark Wielaard 302637
+   int c;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // Args
Mark Wielaard 302637
+   flags.one_arg    = 1;
Mark Wielaard 302637
+   flags.two_args   = 1;
Mark Wielaard 302637
+   flags.three_args = 1;
Mark Wielaard 302637
+   // Type
Mark Wielaard 302637
+   flags.arith      = 1;
Mark Wielaard 302637
+   flags.logical    = 1;
Mark Wielaard 302637
+   flags.compare    = 1;
Mark Wielaard 302637
+   flags.ldst       = 1;
Mark Wielaard 302637
+   // Family
Mark Wielaard 302637
+   flags.integer    = 0;
Mark Wielaard 302637
+   flags.floats     = 0;
Mark Wielaard 302637
+   flags.altivec    = 0;
Mark Wielaard 302637
+   flags.faltivec   = 0;
Mark Wielaard 302637
+   // Flags
Mark Wielaard 302637
+   flags.cr         = 2;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   while ((c = getopt(argc, argv, "ifahvA")) != -1) {
Mark Wielaard 302637
+      switch (c) {
Mark Wielaard 302637
+      case 'i':
Mark Wielaard 302637
+         flags.integer  = 1;
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+      case 'f':
Mark Wielaard 302637
+         flags.floats   = 1;
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+      case 'a':
Mark Wielaard 302637
+         flags.altivec  = 1;
Mark Wielaard 302637
+         flags.faltivec = 1;
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+      case 'A':
Mark Wielaard 302637
+         flags.integer  = 1;
Mark Wielaard 302637
+         flags.floats   = 1;
Mark Wielaard 302637
+         flags.altivec  = 1;
Mark Wielaard 302637
+         flags.faltivec = 1;
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+      case 'h':
Mark Wielaard 302637
+         usage();
Mark Wielaard 302637
+         return 0;
Mark Wielaard 302637
+      case 'v':
Mark Wielaard 302637
+         verbose++;
Mark Wielaard 302637
+         break;
Mark Wielaard 302637
+      default:
Mark Wielaard 302637
+         usage();
Mark Wielaard 302637
+         fprintf(stderr, "Unknown argument: '%c'\n", c);
Mark Wielaard 302637
+         return 1;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+
Mark Wielaard 302637
+   arg_list_size = 0;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   build_vdargs_table();
Mark Wielaard 302637
+   if (verbose > 1) {
Mark Wielaard 302637
+      printf("\nInstruction Selection:\n");
Mark Wielaard 302637
+      printf("  n_args: \n");
Mark Wielaard 302637
+      printf("    one_arg    = %d\n", flags.one_arg);
Mark Wielaard 302637
+      printf("    two_args   = %d\n", flags.two_args);
Mark Wielaard 302637
+      printf("    three_args = %d\n", flags.three_args);
Mark Wielaard 302637
+      printf("  type: \n");
Mark Wielaard 302637
+      printf("    arith      = %d\n", flags.arith);
Mark Wielaard 302637
+      printf("    logical    = %d\n", flags.logical);
Mark Wielaard 302637
+      printf("    compare    = %d\n", flags.compare);
Mark Wielaard 302637
+      printf("    ldst       = %d\n", flags.ldst);
Mark Wielaard 302637
+      printf("  family: \n");
Mark Wielaard 302637
+      printf("    integer    = %d\n", flags.integer);
Mark Wielaard 302637
+      printf("    floats     = %d\n", flags.floats);
Mark Wielaard 302637
+      printf("    altivec    = %d\n", flags.altivec);
Mark Wielaard 302637
+      printf("    faltivec   = %d\n", flags.faltivec);
Mark Wielaard 302637
+      printf("  cr update: \n");
Mark Wielaard 302637
+      printf("    cr         = %d\n", flags.cr);
Mark Wielaard 302637
+      printf("\n");
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+
Mark Wielaard 302637
+   do_tests( flags, filter );
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+   printf("NO ISA 2.07 SUPPORT\n");
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+   return 0;
Mark Wielaard 302637
+}
Mark Wielaard 302637
diff --git a/none/tests/ppc64/test_isa_2_07_part2.c b/none/tests/ppc64/test_isa_2_07_part2.c
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..92e190c
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/test_isa_2_07_part2.c
Mark Wielaard 302637
@@ -0,0 +1,526 @@
Mark Wielaard 302637
+/*  Copyright (C) 2013 IBM
Mark Wielaard 302637
+
Mark Wielaard 302637
+ Authors: Carl Love  <carll@us.ibm.com>
Mark Wielaard 302637
+          Maynard Johnson <maynardj@us.ibm.com>
Mark Wielaard 302637
+
Mark Wielaard 302637
+ This program is free software; you can redistribute it and/or
Mark Wielaard 302637
+ modify it under the terms of the GNU General Public License as
Mark Wielaard 302637
+ published by the Free Software Foundation; either version 2 of the
Mark Wielaard 302637
+ License, or (at your option) any later version.
Mark Wielaard 302637
+
Mark Wielaard 302637
+ This program is distributed in the hope that it will be useful, but
Mark Wielaard 302637
+ WITHOUT ANY WARRANTY; without even the implied warranty of
Mark Wielaard 302637
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Mark Wielaard 302637
+ General Public License for more details.
Mark Wielaard 302637
+
Mark Wielaard 302637
+ You should have received a copy of the GNU General Public License
Mark Wielaard 302637
+ along with this program; if not, write to the Free Software
Mark Wielaard 302637
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
Mark Wielaard 302637
+ 02111-1307, USA.
Mark Wielaard 302637
+
Mark Wielaard 302637
+ The GNU General Public License is contained in the file COPYING.
Mark Wielaard 302637
+
Mark Wielaard 302637
+ This program is based heavily on the test_isa_2_06_part*.c source files.
Mark Wielaard 302637
+ */
Mark Wielaard 302637
+
Mark Wielaard 302637
+#include <stdio.h>
Mark Wielaard 302637
+
Mark Wielaard 302637
+#ifdef HAS_ISA_2_07
Mark Wielaard 302637
+
Mark Wielaard 302637
+#include <stdint.h>
Mark Wielaard 302637
+#include <stdlib.h>
Mark Wielaard 302637
+#include <string.h>
Mark Wielaard 302637
+#include <malloc.h>
Mark Wielaard 302637
+#include <altivec.h>
Mark Wielaard 302637
+#include <math.h>
Mark Wielaard 302637
+
Mark Wielaard 302637
+#ifndef __powerpc64__
Mark Wielaard 302637
+typedef uint32_t HWord_t;
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+typedef uint64_t HWord_t;
Mark Wielaard 302637
+#endif /* __powerpc64__ */
Mark Wielaard 302637
+
Mark Wielaard 302637
+static int errors;
Mark Wielaard 302637
+register HWord_t r14 __asm__ ("r14");
Mark Wielaard 302637
+register HWord_t r15 __asm__ ("r15");
Mark Wielaard 302637
+register HWord_t r16 __asm__ ("r16");
Mark Wielaard 302637
+register HWord_t r17 __asm__ ("r17");
Mark Wielaard 302637
+register double f14 __asm__ ("fr14");
Mark Wielaard 302637
+register double f15 __asm__ ("fr15");
Mark Wielaard 302637
+register double f16 __asm__ ("fr16");
Mark Wielaard 302637
+register double f17 __asm__ ("fr17");
Mark Wielaard 302637
+
Mark Wielaard 302637
+static volatile unsigned int cond_reg;
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define True  1
Mark Wielaard 302637
+#define False 0
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define ALLCR "cr0","cr1","cr2","cr3","cr4","cr5","cr6","cr7"
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_CR(_arg) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mtcr  %0" : : "b"(_arg) : ALLCR );
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_XER(_arg) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mtxer %0" : : "b"(_arg) : "xer" );
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define GET_CR(_lval) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mfcr %0"  : "=b"(_lval) )
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define GET_XER(_lval) \
Mark Wielaard 302637
+      __asm__ __volatile__ ("mfxer %0" : "=b"(_lval) )
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define GET_CR_XER(_lval_cr,_lval_xer) \
Mark Wielaard 302637
+   do { GET_CR(_lval_cr); GET_XER(_lval_xer); } while (0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_CR_ZERO \
Mark Wielaard 302637
+      SET_CR(0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_XER_ZERO \
Mark Wielaard 302637
+      SET_XER(0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_CR_XER_ZERO \
Mark Wielaard 302637
+   do { SET_CR_ZERO; SET_XER_ZERO; } while (0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+#define SET_FPSCR_ZERO \
Mark Wielaard 302637
+   do { double _d = 0.0; \
Mark Wielaard 302637
+        __asm__ __volatile__ ("mtfsf 0xFF, %0" : : "f"(_d) ); \
Mark Wielaard 302637
+   } while (0)
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef void (*test_func_t)(void);
Mark Wielaard 302637
+typedef struct vsx_logic_test logic_test_t;
Mark Wielaard 302637
+typedef struct ldst_test ldst_test_t;
Mark Wielaard 302637
+typedef struct xs_conv_test xs_conv_test_t;
Mark Wielaard 302637
+typedef struct vx_fp_test vx_fp_test_t;
Mark Wielaard 302637
+typedef struct vx_fp_test2 vx_fp_test2_t;
Mark Wielaard 302637
+typedef struct test_table test_table_t;
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef unsigned char Bool;
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+/* These functions below that construct a table of floating point
Mark Wielaard 302637
+ * values were lifted from none/tests/ppc32/jm-insns.c.
Mark Wielaard 302637
+ */
Mark Wielaard 302637
+
Mark Wielaard 302637
+#if defined (DEBUG_ARGS_BUILD)
Mark Wielaard 302637
+#define AB_DPRINTF(fmt, args...) do { fprintf(stderr, fmt , ##args); } while (0)
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+#define AB_DPRINTF(fmt, args...) do { } while (0)
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+
Mark Wielaard 302637
+static inline void register_farg (void *farg,
Mark Wielaard 302637
+                                  int s, uint16_t _exp, uint64_t mant)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   uint64_t tmp;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   tmp = ((uint64_t)s << 63) | ((uint64_t)_exp << 52) | mant;
Mark Wielaard 302637
+   *(uint64_t *)farg = tmp;
Mark Wielaard 302637
+   AB_DPRINTF("%d %03x %013llx => %016llx %0e\n",
Mark Wielaard 302637
+              s, _exp, mant, *(uint64_t *)farg, *(double *)farg);
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef struct fp_test_args {
Mark Wielaard 302637
+   int fra_idx;
Mark Wielaard 302637
+   int frb_idx;
Mark Wielaard 302637
+   int cr_flags;
Mark Wielaard 302637
+   unsigned long long dp_bin_result;
Mark Wielaard 302637
+} fp_test_args_t;
Mark Wielaard 302637
+
Mark Wielaard 302637
+static int nb_special_fargs;
Mark Wielaard 302637
+static double * spec_fargs;
Mark Wielaard 302637
+static float * spec_sp_fargs;
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void build_special_fargs_table(void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   /* The special floating point values created below are for
Mark Wielaard 302637
+    * use in the ftdiv tests for setting the fe_flag and fg_flag,
Mark Wielaard 302637
+    * but they can also be used for other tests (e.g., xscmpudp).
Mark Wielaard 302637
+    *
Mark Wielaard 302637
+    * Note that fl_flag is 'always '1' on ppc64 Linux.
Mark Wielaard 302637
+    *
Mark Wielaard 302637
+  Entry  Sign Exp   fraction                  Special value
Mark Wielaard 302637
+   0      0   3fd   0x8000000000000ULL         Positive finite number
Mark Wielaard 302637
+   1      0   404   0xf000000000000ULL         ...
Mark Wielaard 302637
+   2      0   001   0x8000000b77501ULL         ...
Mark Wielaard 302637
+   3      0   7fe   0x800000000051bULL         ...
Mark Wielaard 302637
+   4      0   012   0x3214569900000ULL         ...
Mark Wielaard 302637
+   5      0   000   0x0000000000000ULL         +0.0 (+zero)
Mark Wielaard 302637
+   6      1   000   0x0000000000000ULL         -0.0 (-zero)
Mark Wielaard 302637
+   7      0   7ff   0x0000000000000ULL         +infinity
Mark Wielaard 302637
+   8      1   7ff   0x0000000000000ULL         -infinity
Mark Wielaard 302637
+   9      0   7ff   0x7FFFFFFFFFFFFULL         +QNaN
Mark Wielaard 302637
+   10     1   7ff   0x7FFFFFFFFFFFFULL         -QNaN
Mark Wielaard 302637
+   11     0   7ff   0x8000000000000ULL         +SNaN
Mark Wielaard 302637
+   12     1   7ff   0x8000000000000ULL         -SNaN
Mark Wielaard 302637
+   13     1   000   0x8340000078000ULL         Denormalized val (zero exp and non-zero fraction)
Mark Wielaard 302637
+   14     1   40d   0x0650f5a07b353ULL         Negative finite number
Mark Wielaard 302637
+    */
Mark Wielaard 302637
+
Mark Wielaard 302637
+   uint64_t mant;
Mark Wielaard 302637
+   uint16_t _exp;
Mark Wielaard 302637
+   int s;
Mark Wielaard 302637
+   int j, i = 0;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   if (spec_fargs)
Mark Wielaard 302637
+      return;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   spec_fargs = malloc( 20 * sizeof(double) );
Mark Wielaard 302637
+   spec_sp_fargs = malloc( 20 * sizeof(float) );
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #0
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x3fd;
Mark Wielaard 302637
+   mant = 0x8000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #1
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x404;
Mark Wielaard 302637
+   mant = 0xf000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #2
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x001;
Mark Wielaard 302637
+   mant = 0x8000000b77501ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #3
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x7fe;
Mark Wielaard 302637
+   mant = 0x800000000051bULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #4
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x012;
Mark Wielaard 302637
+   mant = 0x3214569900000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* Special values */
Mark Wielaard 302637
+   /* +0.0      : 0 0x000 0x0000000000000 */
Mark Wielaard 302637
+   // #5
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x000;
Mark Wielaard 302637
+   mant = 0x0000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* -0.0      : 1 0x000 0x0000000000000 */
Mark Wielaard 302637
+   // #6
Mark Wielaard 302637
+   s = 1;
Mark Wielaard 302637
+   _exp = 0x000;
Mark Wielaard 302637
+   mant = 0x0000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* +infinity : 0 0x7FF 0x0000000000000  */
Mark Wielaard 302637
+   // #7
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x7FF;
Mark Wielaard 302637
+   mant = 0x0000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* -infinity : 1 0x7FF 0x0000000000000 */
Mark Wielaard 302637
+   // #8
Mark Wielaard 302637
+   s = 1;
Mark Wielaard 302637
+   _exp = 0x7FF;
Mark Wielaard 302637
+   mant = 0x0000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* +QNaN     : 0 0x7FF 0x7FFFFFFFFFFFF */
Mark Wielaard 302637
+   // #9
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x7FF;
Mark Wielaard 302637
+   mant = 0x7FFFFFFFFFFFFULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* -QNaN     : 1 0x7FF 0x7FFFFFFFFFFFF */
Mark Wielaard 302637
+   // #10
Mark Wielaard 302637
+   s = 1;
Mark Wielaard 302637
+   _exp = 0x7FF;
Mark Wielaard 302637
+   mant = 0x7FFFFFFFFFFFFULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* +SNaN     : 0 0x7FF 0x8000000000000 */
Mark Wielaard 302637
+   // #11
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x7FF;
Mark Wielaard 302637
+   mant = 0x8000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* -SNaN     : 1 0x7FF 0x8000000000000 */
Mark Wielaard 302637
+   // #12
Mark Wielaard 302637
+   s = 1;
Mark Wielaard 302637
+   _exp = 0x7FF;
Mark Wielaard 302637
+   mant = 0x8000000000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* denormalized value */
Mark Wielaard 302637
+   // #13
Mark Wielaard 302637
+   s = 1;
Mark Wielaard 302637
+   _exp = 0x000;
Mark Wielaard 302637
+   mant = 0x8340000078000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* Negative finite number */
Mark Wielaard 302637
+   // #14
Mark Wielaard 302637
+   s = 1;
Mark Wielaard 302637
+   _exp = 0x40d;
Mark Wielaard 302637
+   mant = 0x0650f5a07b353ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   /* A few positive finite numbers ... */
Mark Wielaard 302637
+   // #15
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x412;
Mark Wielaard 302637
+   mant = 0x32585a9900000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #16
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x413;
Mark Wielaard 302637
+   mant = 0x82511a2000000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #17
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x403;
Mark Wielaard 302637
+   mant = 0x12ef5a9300000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #18
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x405;
Mark Wielaard 302637
+   mant = 0x14bf5d2300000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+   // #19
Mark Wielaard 302637
+   s = 0;
Mark Wielaard 302637
+   _exp = 0x409;
Mark Wielaard 302637
+   mant = 0x76bf982440000ULL;
Mark Wielaard 302637
+   register_farg(&spec_fargs[i++], s, _exp, mant);
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+   nb_special_fargs = i;
Mark Wielaard 302637
+   for (j = 0; j < i; j++) {
Mark Wielaard 302637
+      spec_sp_fargs[j] = spec_fargs[j];
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+struct test_table
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   test_func_t test_category;
Mark Wielaard 302637
+   char * name;
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef enum {
Mark Wielaard 302637
+   SINGLE_TEST,
Mark Wielaard 302637
+   DOUBLE_TEST,
Mark Wielaard 302637
+   DOUBLE_TEST_SINGLE_RES
Mark Wielaard 302637
+} precision_type_t;
Mark Wielaard 302637
+
Mark Wielaard 302637
+typedef enum {
Mark Wielaard 302637
+   VX_FP_SMAS,   // multiply add single precision result
Mark Wielaard 302637
+   VX_FP_SMSS,   // multiply sub single precision result
Mark Wielaard 302637
+   VX_FP_SNMAS,  // negative multiply add single precision result
Mark Wielaard 302637
+   VX_FP_SNMSS,  // negative multiply sub single precision result
Mark Wielaard 302637
+   VX_FP_OTHER,
Mark Wielaard 302637
+   VX_CONV_WORD,
Mark Wielaard 302637
+   VX_ESTIMATE,
Mark Wielaard 302637
+   VX_CONV_TO_SINGLE,
Mark Wielaard 302637
+   VX_CONV_TO_DOUBLE,
Mark Wielaard 302637
+   VX_SCALAR_CONV_TO_WORD,
Mark Wielaard 302637
+   VX_DEFAULT
Mark Wielaard 302637
+} vx_fp_test_type;
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+struct vx_fp_test2
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   test_func_t test_func;
Mark Wielaard 302637
+   const char *name;
Mark Wielaard 302637
+   fp_test_args_t * targs;
Mark Wielaard 302637
+   int num_tests;
Mark Wielaard 302637
+   precision_type_t precision;
Mark Wielaard 302637
+   vx_fp_test_type test_type;
Mark Wielaard 302637
+   const char * op;
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+static vector unsigned int vec_out, vec_inB;
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_xscvdpspn(void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("xscvdpspn   %x0, %x1" : "=wa" (vec_out): "wa" (vec_inB));
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_xscvspdpn(void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   __asm__ __volatile__ ("xscvspdpn  %x0, %x1" : "=wa" (vec_out): "wa" (vec_inB));
Mark Wielaard 302637
+}
Mark Wielaard 302637
+static vx_fp_test2_t
Mark Wielaard 302637
+vsx_one_fp_arg_tests[] = {
Mark Wielaard 302637
+                                { &test_xscvdpspn, "xscvdpspn", NULL, 20, DOUBLE_TEST, VX_CONV_TO_SINGLE, "conv"},
Mark Wielaard 302637
+                                { &test_xscvspdpn, "xscvspdpn", NULL, 20, SINGLE_TEST, VX_CONV_TO_DOUBLE, "conv"},
Mark Wielaard 302637
+                                { NULL, NULL, NULL, 0, 0, 0, NULL}
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
+static void test_vsx_one_fp_arg(void)
Mark Wielaard 302637
+{
Mark Wielaard 302637
+   test_func_t func;
Mark Wielaard 302637
+   int k;
Mark Wielaard 302637
+   k = 0;
Mark Wielaard 302637
+   build_special_fargs_table();
Mark Wielaard 302637
+
Mark Wielaard 302637
+   while ((func = vsx_one_fp_arg_tests[k].test_func)) {
Mark Wielaard 302637
+      int idx, i;
Mark Wielaard 302637
+      vx_fp_test2_t test_group = vsx_one_fp_arg_tests[k];
Mark Wielaard 302637
+      /* size of source operands */
Mark Wielaard 302637
+      Bool dp  = ((test_group.precision == DOUBLE_TEST) ||
Mark Wielaard 302637
+		  (test_group.precision == DOUBLE_TEST_SINGLE_RES)) ? True : False;
Mark Wielaard 302637
+      /* size of result */
Mark Wielaard 302637
+      Bool is_sqrt = (strstr(test_group.name, "sqrt")) ? True : False;
Mark Wielaard 302637
+      Bool is_scalar = (strstr(test_group.name, "xs")) ? True : False;
Mark Wielaard 302637
+      Bool sparse_sp = False;
Mark Wielaard 302637
+      int stride = dp ? 2 : 4;
Mark Wielaard 302637
+      int loops = is_scalar ? 1 : stride;
Mark Wielaard 302637
+      stride = is_scalar ? 1: stride;
Mark Wielaard 302637
+
Mark Wielaard 302637
+      /* For conversions of single to double, the 128-bit input register is sparsely populated:
Mark Wielaard 302637
+       *    |___ SP___|_Unused_|___SP___|__Unused__|   // for vector op
Mark Wielaard 302637
+       *                     or
Mark Wielaard 302637
+       *    |___ SP___|_Unused_|_Unused_|__Unused__|   // for scalar op
Mark Wielaard 302637
+       *
Mark Wielaard 302637
+       * For the vector op case, we need to adjust stride from '4' to '2', since
Mark Wielaard 302637
+       * we'll only be loading two values per loop into the input register.
Mark Wielaard 302637
+       */
Mark Wielaard 302637
+      if (!dp && !is_scalar && test_group.test_type == VX_CONV_TO_DOUBLE) {
Mark Wielaard 302637
+         sparse_sp = True;
Mark Wielaard 302637
+         stride = 2;
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+
Mark Wielaard 302637
+      for (i = 0; i < test_group.num_tests; i+=stride) {
Mark Wielaard 302637
+         unsigned int * pv;
Mark Wielaard 302637
+         void * inB;
Mark Wielaard 302637
+
Mark Wielaard 302637
+         pv = (unsigned int *)&vec_out;
Mark Wielaard 302637
+         // clear vec_out
Mark Wielaard 302637
+         for (idx = 0; idx < 4; idx++, pv++)
Mark Wielaard 302637
+            *pv = 0;
Mark Wielaard 302637
+
Mark Wielaard 302637
+         if (dp) {
Mark Wielaard 302637
+            int j;
Mark Wielaard 302637
+            unsigned long long * frB_dp, *dst_dp;
Mark Wielaard 302637
+            for (j = 0; j < loops; j++) {
Mark Wielaard 302637
+               inB = (void *)&spec_fargs[i + j];
Mark Wielaard 302637
+               // copy double precision FP into vector element i
Mark Wielaard 302637
+               memcpy(((void *)&vec_inB) + (j * 8), inB, 8);
Mark Wielaard 302637
+            }
Mark Wielaard 302637
+            // execute test insn
Mark Wielaard 302637
+            (*func)();
Mark Wielaard 302637
+            dst_dp = (unsigned long long *) &vec_out;
Mark Wielaard 302637
+            printf("#%d: %s ", i/stride, test_group.name);
Mark Wielaard 302637
+            for (j = 0; j < loops; j++) {
Mark Wielaard 302637
+               if (j)
Mark Wielaard 302637
+                  printf("; ");
Mark Wielaard 302637
+               frB_dp = (unsigned long long *)&spec_fargs[i + j];
Mark Wielaard 302637
+               printf("%s(%016llx)", test_group.op, *frB_dp);
Mark Wielaard 302637
+               vx_fp_test_type type = test_group.test_type;
Mark Wielaard 302637
+               switch (type) {
Mark Wielaard 302637
+                  case VX_SCALAR_CONV_TO_WORD:
Mark Wielaard 302637
+                     printf(" = %016llx", dst_dp[j] & 0x00000000ffffffffULL);
Mark Wielaard 302637
+                     break;
Mark Wielaard 302637
+                  case VX_CONV_TO_SINGLE:
Mark Wielaard 302637
+                     printf(" = %016llx", dst_dp[j] & 0xffffffff00000000ULL);
Mark Wielaard 302637
+                     break;
Mark Wielaard 302637
+                  default:  // For VX_CONV_TO_DOUBLE and non-convert instructions . . .
Mark Wielaard 302637
+                     printf(" = %016llx", dst_dp[j]);
Mark Wielaard 302637
+               }
Mark Wielaard 302637
+            }
Mark Wielaard 302637
+            printf("\n");
Mark Wielaard 302637
+         } else {
Mark Wielaard 302637
+            int j, skip_slot;
Mark Wielaard 302637
+            unsigned int * frB_sp, * dst_sp = NULL;
Mark Wielaard 302637
+            unsigned long long * dst_dp = NULL;
Mark Wielaard 302637
+            if (sparse_sp) {
Mark Wielaard 302637
+               skip_slot = 1;
Mark Wielaard 302637
+               loops = 2;
Mark Wielaard 302637
+            } else {
Mark Wielaard 302637
+               skip_slot = 0;
Mark Wielaard 302637
+            }
Mark Wielaard 302637
+            for (j = 0; j < loops; j++) {
Mark Wielaard 302637
+               inB = (void *)&spec_sp_fargs[i + j];
Mark Wielaard 302637
+               // copy single precision FP into vector element i
Mark Wielaard 302637
+
Mark Wielaard 302637
+               if (skip_slot && j > 0)
Mark Wielaard 302637
+                  memcpy(((void *)&vec_inB) + ((j + j) * 4), inB, 4);
Mark Wielaard 302637
+               else
Mark Wielaard 302637
+                  memcpy(((void *)&vec_inB) + (j * 4), inB, 4);
Mark Wielaard 302637
+            }
Mark Wielaard 302637
+            // execute test insn
Mark Wielaard 302637
+            (*func)();
Mark Wielaard 302637
+            if (test_group.test_type == VX_CONV_TO_DOUBLE)
Mark Wielaard 302637
+               dst_dp = (unsigned long long *) &vec_out;
Mark Wielaard 302637
+            else
Mark Wielaard 302637
+               dst_sp = (unsigned int *) &vec_out;
Mark Wielaard 302637
+            // print result
Mark Wielaard 302637
+            printf("#%d: %s ", i/stride, test_group.name);
Mark Wielaard 302637
+            for (j = 0; j < loops; j++) {
Mark Wielaard 302637
+               if (j)
Mark Wielaard 302637
+                  printf("; ");
Mark Wielaard 302637
+               frB_sp = (unsigned int *)&spec_sp_fargs[i + j];
Mark Wielaard 302637
+               printf("%s(%08x)", test_group.op, *frB_sp);
Mark Wielaard 302637
+               if (test_group.test_type == VX_CONV_TO_DOUBLE)
Mark Wielaard 302637
+                     printf(" = %016llx", dst_dp[j]);
Mark Wielaard 302637
+               else
Mark Wielaard 302637
+               /* Special case: Current VEX implementation for fsqrts (single precision)
Mark Wielaard 302637
+                * uses the same implementation as that used for double precision fsqrt.
Mark Wielaard 302637
+                * However, I've found that for xvsqrtsp, the result from that implementation
Mark Wielaard 302637
+                * may be off by the two LSBs.  Generally, even this small inaccuracy can cause the
Mark Wielaard 302637
+                * output to appear very different if you end up with a carry.  But for the given
Mark Wielaard 302637
+                * inputs in this testcase, we can simply mask out these bits.
Mark Wielaard 302637
+                */
Mark Wielaard 302637
+                  printf(" = %08x", is_sqrt ? (dst_sp[j] & 0xfffffffc) : dst_sp[j]);
Mark Wielaard 302637
+            }
Mark Wielaard 302637
+            printf("\n");
Mark Wielaard 302637
+         }
Mark Wielaard 302637
+      }
Mark Wielaard 302637
+      k++;
Mark Wielaard 302637
+      printf( "\n" );
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+}
Mark Wielaard 302637
+
Mark Wielaard 302637
+//----------------------------------------------------------
Mark Wielaard 302637
+
Mark Wielaard 302637
+static test_table_t all_tests[] = {
Mark Wielaard 302637
+                                     { &test_vsx_one_fp_arg,
Mark Wielaard 302637
+                                       "Test VSX vector and scalar single argument instructions"} ,
Mark Wielaard 302637
+                                     { NULL, NULL }
Mark Wielaard 302637
+};
Mark Wielaard 302637
+
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+
Mark Wielaard 302637
+int main(int argc, char *argv[])
Mark Wielaard 302637
+{
Mark Wielaard 302637
+
Mark Wielaard 302637
+#ifdef HAS_ISA_2_07
Mark Wielaard 302637
+   test_table_t aTest;
Mark Wielaard 302637
+   test_func_t func;
Mark Wielaard 302637
+   int i = 0;
Mark Wielaard 302637
+
Mark Wielaard 302637
+   while ((func = all_tests[i].test_category)) {
Mark Wielaard 302637
+      aTest = all_tests[i];
Mark Wielaard 302637
+      printf( "%s\n", aTest.name );
Mark Wielaard 302637
+      (*func)();
Mark Wielaard 302637
+      i++;
Mark Wielaard 302637
+   }
Mark Wielaard 302637
+   if (errors)
Mark Wielaard 302637
+      printf("Testcase FAILED with %d errors \n", errors);
Mark Wielaard 302637
+   else
Mark Wielaard 302637
+      printf("Testcase PASSED\n");
Mark Wielaard 302637
+
Mark Wielaard 302637
+#else
Mark Wielaard 302637
+   printf("NO ISA 2.07 SUPPORT\n");
Mark Wielaard 302637
+#endif
Mark Wielaard 302637
+   return 0;
Mark Wielaard 302637
+}
Mark Wielaard 302637
diff --git a/none/tests/ppc64/test_isa_2_07_part2.stderr.exp b/none/tests/ppc64/test_isa_2_07_part2.stderr.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..139597f
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/test_isa_2_07_part2.stderr.exp
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+
Mark Wielaard 302637
+
Mark Wielaard 302637
diff --git a/none/tests/ppc64/test_isa_2_07_part2.stdout.exp b/none/tests/ppc64/test_isa_2_07_part2.stdout.exp
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..c65c574
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/test_isa_2_07_part2.stdout.exp
Mark Wielaard 302637
@@ -0,0 +1,44 @@
Mark Wielaard 302637
+Test VSX vector and scalar single argument instructions
Mark Wielaard 302637
+#0: xscvdpspn conv(3fd8000000000000) = 3ec0000000000000
Mark Wielaard 302637
+#1: xscvdpspn conv(404f000000000000) = 4278000000000000
Mark Wielaard 302637
+#2: xscvdpspn conv(0018000000b77501) = 0000000000000000
Mark Wielaard 302637
+#3: xscvdpspn conv(7fe800000000051b) = 7f40000000000000
Mark Wielaard 302637
+#4: xscvdpspn conv(0123214569900000) = 0000000000000000
Mark Wielaard 302637
+#5: xscvdpspn conv(0000000000000000) = 0000000000000000
Mark Wielaard 302637
+#6: xscvdpspn conv(8000000000000000) = 8000000000000000
Mark Wielaard 302637
+#7: xscvdpspn conv(7ff0000000000000) = 7f80000000000000
Mark Wielaard 302637
+#8: xscvdpspn conv(fff0000000000000) = ff80000000000000
Mark Wielaard 302637
+#9: xscvdpspn conv(7ff7ffffffffffff) = 7fbfffff00000000
Mark Wielaard 302637
+#10: xscvdpspn conv(fff7ffffffffffff) = ffbfffff00000000
Mark Wielaard 302637
+#11: xscvdpspn conv(7ff8000000000000) = 7fc0000000000000
Mark Wielaard 302637
+#12: xscvdpspn conv(fff8000000000000) = ffc0000000000000
Mark Wielaard 302637
+#13: xscvdpspn conv(8008340000078000) = 8000000000000000
Mark Wielaard 302637
+#14: xscvdpspn conv(c0d0650f5a07b353) = c683287a00000000
Mark Wielaard 302637
+#15: xscvdpspn conv(41232585a9900000) = 49192c2d00000000
Mark Wielaard 302637
+#16: xscvdpspn conv(41382511a2000000) = 49c1288d00000000
Mark Wielaard 302637
+#17: xscvdpspn conv(40312ef5a9300000) = 418977ad00000000
Mark Wielaard 302637
+#18: xscvdpspn conv(40514bf5d2300000) = 428a5fae00000000
Mark Wielaard 302637
+#19: xscvdpspn conv(40976bf982440000) = 44bb5fcc00000000
Mark Wielaard 302637
+
Mark Wielaard 302637
+#0: xscvspdpn conv(3ec00000) = 3fd8000000000000
Mark Wielaard 302637
+#1: xscvspdpn conv(42780000) = 404f000000000000
Mark Wielaard 302637
+#2: xscvspdpn conv(00000000) = 0000000000000000
Mark Wielaard 302637
+#3: xscvspdpn conv(7f800000) = 7ff0000000000000
Mark Wielaard 302637
+#4: xscvspdpn conv(00000000) = 0000000000000000
Mark Wielaard 302637
+#5: xscvspdpn conv(00000000) = 0000000000000000
Mark Wielaard 302637
+#6: xscvspdpn conv(80000000) = 8000000000000000
Mark Wielaard 302637
+#7: xscvspdpn conv(7f800000) = 7ff0000000000000
Mark Wielaard 302637
+#8: xscvspdpn conv(ff800000) = fff0000000000000
Mark Wielaard 302637
+#9: xscvspdpn conv(7fffffff) = 7fffffffe0000000
Mark Wielaard 302637
+#10: xscvspdpn conv(ffffffff) = ffffffffe0000000
Mark Wielaard 302637
+#11: xscvspdpn conv(7fc00000) = 7ff8000000000000
Mark Wielaard 302637
+#12: xscvspdpn conv(ffc00000) = fff8000000000000
Mark Wielaard 302637
+#13: xscvspdpn conv(80000000) = 8000000000000000
Mark Wielaard 302637
+#14: xscvspdpn conv(c683287b) = c0d0650f60000000
Mark Wielaard 302637
+#15: xscvspdpn conv(49192c2d) = 41232585a0000000
Mark Wielaard 302637
+#16: xscvspdpn conv(49c1288d) = 41382511a0000000
Mark Wielaard 302637
+#17: xscvspdpn conv(418977ad) = 40312ef5a0000000
Mark Wielaard 302637
+#18: xscvspdpn conv(428a5faf) = 40514bf5e0000000
Mark Wielaard 302637
+#19: xscvspdpn conv(44bb5fcc) = 40976bf980000000
Mark Wielaard 302637
+
Mark Wielaard 302637
+Testcase PASSED
Mark Wielaard 302637
diff --git a/none/tests/ppc64/test_isa_2_07_part2.vgtest b/none/tests/ppc64/test_isa_2_07_part2.vgtest
Mark Wielaard 302637
new file mode 100644
Mark Wielaard 302637
index 0000000..a4649be
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/none/tests/ppc64/test_isa_2_07_part2.vgtest
Mark Wielaard 302637
@@ -0,0 +1,2 @@
Mark Wielaard 302637
+prereq: ../../../tests/check_isa-2_07_cap
Mark Wielaard 302637
+prog: test_isa_2_07_part2
Mark Wielaard 302637
diff --git a/tests/check_isa-2_07_cap b/tests/check_isa-2_07_cap
Mark Wielaard 302637
new file mode 100755
Mark Wielaard 302637
index 0000000..ee777c1
Mark Wielaard 302637
--- /dev/null
Mark Wielaard 302637
+++ b/tests/check_isa-2_07_cap
Mark Wielaard 302637
@@ -0,0 +1,12 @@
Mark Wielaard 302637
+#!/bin/sh
Mark Wielaard 302637
+
Mark Wielaard 302637
+# We use this script to check whether or not the processor supports
Mark Wielaard 302637
+# Power ISA 2.07.
Mark Wielaard 302637
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Mark Wielaard 302637
+LD_SHOW_AUXV=1 $DIR/true | grep  arch_2_07 > /dev/null 2>&1
Mark Wielaard 302637
+
Mark Wielaard 302637
+if [ "$?" -ne "0" ]; then
Mark Wielaard 302637
+	exit 1
Mark Wielaard 302637
+else
Mark Wielaard 302637
+	exit 0
Mark Wielaard 302637
+fi