Mark Wielaard 1cb064
commit 3950c5d661ee09526cddcf24daf5fc22bc83f70c
Mark Wielaard 1cb064
Author: Carl Love <cel@us.ibm.com>
Mark Wielaard 1cb064
Date:   Mon Nov 1 11:18:32 2021 -0500
Mark Wielaard 1cb064
Mark Wielaard 1cb064
    Valgrind Add powerpc R=1 tests
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    Contributed by Will Schmidt <will_schmidt@vnet.ibm.com>
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    This includes updates and adjustments as suggested by Carl.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    Add tests that exercise PCRelative instructions.
Mark Wielaard 1cb064
    These instructions are encoded with R==1, which indicate that
Mark Wielaard 1cb064
    the memory accessed by the instruction is at a location
Mark Wielaard 1cb064
    relative to the currently executing instruction.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    These tests are built using -Wl,-text and -Wl,-bss
Mark Wielaard 1cb064
    options to ensure the location of the target array is at a
Mark Wielaard 1cb064
    location with a specific offset from the currently
Mark Wielaard 1cb064
    executing instruction.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    The write instructions are aimed at a large buffer in
Mark Wielaard 1cb064
    the bss section; which is checked for updates at the
Mark Wielaard 1cb064
    completion of each test.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    In order to ensure consistent output across assorted
Mark Wielaard 1cb064
    systems, the tests have been padded with ori, nop instructions
Mark Wielaard 1cb064
    and align directives.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
    Detailed changes:
Mark Wielaard 1cb064
     * Makefile.am: Add test_isa_3_1_R1_RT and test_isa_3_1_R1_XT tests.
Mark Wielaard 1cb064
     * isa_3_1_helpers.h: Add identify_instruction_by_func_name() helper function
Mark Wielaard 1cb064
       to indicate if the test is for R==1.
Mark Wielaard 1cb064
       Add helpers to initialize and print changes to the pcrelative_write_target
Mark Wielaard 1cb064
       array.
Mark Wielaard 1cb064
       Add #define to help pad code with a series of eyecatcher ORI instructions.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_RT.c: New test.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_XT.c: New test.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_XT.stdout.exp: New expected output.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_XT.stdout.exp: New expected output.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_RT.stderr.exp: New expected output.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_RT.stderr.exp: New expected output.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
         * test_isa_3_1_R1_RT.vgtest: New test handler.
Mark Wielaard 1cb064
         * test_isa_3_1_R1_XT.vgtest: New test handler.
Mark Wielaard 1cb064
    
Mark Wielaard 1cb064
         * test_isa_3_1_common.c: Add indicators (updates_byte,updates_halfword,
Mark Wielaard 1cb064
           updates_word) indicators to control the output from the R==1 tests.
Mark Wielaard 1cb064
           Add helper check for "_R1" to indicate if instruction is coded with R==1.
Mark Wielaard 1cb064
           Add init and print helpers for the pcrelative_write_target array.
Mark Wielaard 1cb064
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am
Mark Wielaard 1cb064
index b709f3ef4..f8eab9fc0 100644
Mark Wielaard 1cb064
--- a/none/tests/ppc64/Makefile.am
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/Makefile.am
Mark Wielaard 1cb064
@@ -61,6 +61,8 @@ EXTRA_DIST = \
Mark Wielaard 1cb064
 	test_isa_3_1_VRT.vgtest test_isa_3_1_VRT.stderr.exp test_isa_3_1_VRT.stdout.exp \
Mark Wielaard 1cb064
 	test_isa_3_1_Misc.vgtest test_isa_3_1_Misc.stderr.exp test_isa_3_1_Misc.stdout.exp \
Mark Wielaard 1cb064
 	test_isa_3_1_AT.vgtest test_isa_3_1_AT.stderr.exp test_isa_3_1_AT.stdout.exp \
Mark Wielaard 1cb064
+	test_isa_3_1_R1_RT.vgtest test_isa_3_1_R1_RT.stderr.exp test_isa_3_1_R1_RT.stdout.exp \
Mark Wielaard 1cb064
+	test_isa_3_1_R1_XT.vgtest test_isa_3_1_R1_XT.stderr.exp test_isa_3_1_R1_XT.stdout.exp \
Mark Wielaard 1cb064
 	subnormal_test.stderr.exp  subnormal_test.stdout.exp \
Mark Wielaard 1cb064
 	subnormal_test.vgtest test_darn_inst.stderr.exp \
Mark Wielaard 1cb064
 	test_darn_inst.stdout.exp test_darn_inst.vgtest \
Mark Wielaard 1cb064
@@ -68,8 +70,8 @@ EXTRA_DIST = \
Mark Wielaard 1cb064
 	test_copy_paste.stderr.exp test_copy_paste.stdout.exp \
Mark Wielaard 1cb064
 	test_copy_paste.vgtest \
Mark Wielaard 1cb064
 	test_mcrxrx.vgtest test_mcrxrx.stderr.exp test_mcrxrx.stdout.exp \
Mark Wielaard 1cb064
-	test_lxvx_stxvx.vgtest test_lxvx_stxvx.stderr.exp test_lxvx_stxvx.stdout.exp-p8  test_lxvx_stxvx.stdout.exp-p9
Mark Wielaard 1cb064
-
Mark Wielaard 1cb064
+	test_lxvx_stxvx.vgtest test_lxvx_stxvx.stderr.exp \
Mark Wielaard 1cb064
+	test_lxvx_stxvx.stdout.exp-p8  test_lxvx_stxvx.stdout.exp-p9
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
 check_PROGRAMS = \
Mark Wielaard 1cb064
 	allexec \
Mark Wielaard 1cb064
@@ -80,11 +82,12 @@ check_PROGRAMS = \
Mark Wielaard 1cb064
 	test_isa_3_0 test_mod_instructions \
Mark Wielaard 1cb064
 	test_isa_3_1_RT test_isa_3_1_XT test_isa_3_1_VRT \
Mark Wielaard 1cb064
 	test_isa_3_1_Misc test_isa_3_1_AT \
Mark Wielaard 1cb064
+	test_isa_3_1_R1_RT test_isa_3_1_R1_XT \
Mark Wielaard 1cb064
 	subnormal_test test_darn_inst test_copy_paste \
Mark Wielaard 1cb064
 	test_tm test_touch_tm data-cache-instructions \
Mark Wielaard 1cb064
 	std_reg_imm \
Mark Wielaard 1cb064
 	twi_tdi tw_td power6_bcmp scv_test \
Mark Wielaard 1cb064
-	test_mcrxrx  test_lxvx_stxvx
Mark Wielaard 1cb064
+	test_mcrxrx test_lxvx_stxvx
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
 # lmw, stmw, lswi, lswx, stswi, stswx compile (and run) only on big endian.
Mark Wielaard 1cb064
 if VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX
Mark Wielaard 1cb064
@@ -106,6 +109,8 @@ test_isa_3_1_RT_SOURCES = test_isa_3_1_RT.c test_isa_3_1_common.c
Mark Wielaard 1cb064
 test_isa_3_1_VRT_SOURCES = test_isa_3_1_VRT.c test_isa_3_1_common.c
Mark Wielaard 1cb064
 test_isa_3_1_Misc_SOURCES = test_isa_3_1_Misc.c test_isa_3_1_common.c
Mark Wielaard 1cb064
 test_isa_3_1_AT_SOURCES = test_isa_3_1_AT.c test_isa_3_1_common.c
Mark Wielaard 1cb064
+test_isa_3_1_R1_XT_SOURCES = test_isa_3_1_R1_XT.c test_isa_3_1_common.c
Mark Wielaard 1cb064
+test_isa_3_1_R1_RT_SOURCES = test_isa_3_1_R1_RT.c test_isa_3_1_common.c
Mark Wielaard 1cb064
 test_darn_inst_SOURCES = test_darn_inst.c
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
 if HAS_ALTIVEC
Mark Wielaard 1cb064
@@ -224,6 +229,11 @@ test_isa_3_1_VRT_CFLAGS = $(test_isa_3_1_CFLAGS)
Mark Wielaard 1cb064
 test_isa_3_1_Misc_CFLAGS = $(test_isa_3_1_CFLAGS)
Mark Wielaard 1cb064
 test_isa_3_1_AT_CFLAGS = $(test_isa_3_1_CFLAGS)
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
+# The _R1_foo tests exercise pc-relative instructions, so require the bss and text sections
Mark Wielaard 1cb064
+# exist at known offsets with respect to each other.
Mark Wielaard 1cb064
+test_isa_3_1_R1_RT_CFLAGS = $(test_isa_3_1_CFLAGS) -Wl,-Tbss,0x20000 -Wl,-Ttext,0x40000
Mark Wielaard 1cb064
+test_isa_3_1_R1_XT_CFLAGS = $(test_isa_3_1_CFLAGS) -Wl,-Tbss,0x20000 -Wl,-Ttext,0x40000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
 subnormal_test_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_FLAG) $(ISA_2_06_FLAG) \
Mark Wielaard 1cb064
 			@FLAG_M64@ $(ALTIVEC_FLAG) $(BUILD_FLAG_VSX) $(BUILD_FLAGS_ISA_2_06)
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/isa_3_1_helpers.h b/none/tests/ppc64/isa_3_1_helpers.h
Mark Wielaard 1cb064
index 338f55526..716a6277b 100644
Mark Wielaard 1cb064
--- a/none/tests/ppc64/isa_3_1_helpers.h
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/isa_3_1_helpers.h
Mark Wielaard 1cb064
@@ -43,6 +43,9 @@ extern void debug_show_current_iteration();
Mark Wielaard 1cb064
 extern void debug_dump_buffer();
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
 extern void identify_form_components(const char *, const char *);
Mark Wielaard 1cb064
+extern void identify_instruction_by_func_name(const char *);
Mark Wielaard 1cb064
+extern void init_pcrelative_write_target();
Mark Wielaard 1cb064
+extern void print_pcrelative_write_target();
Mark Wielaard 1cb064
 extern void dump_vsxargs();
Mark Wielaard 1cb064
 extern void generic_prologue();
Mark Wielaard 1cb064
 extern void build_args_table();
Mark Wielaard 1cb064
@@ -58,6 +61,21 @@ extern void initialize_source_registers();
Mark Wielaard 1cb064
 extern void set_up_iterators();
Mark Wielaard 1cb064
 extern void initialize_buffer(int);
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
+/* This (TEXT_BSS_DELTA) is the relative distance between those
Mark Wielaard 1cb064
+   sections as set by the linker options for the R==1 tests. */
Mark Wielaard 1cb064
+#define TEXT_BSS_DELTA 0x20000
Mark Wielaard 1cb064
+#define RELOC_BUFFER_SIZE 0x1000
Mark Wielaard 1cb064
+extern unsigned long long pcrelative_buff_addr(int);
Mark Wielaard 1cb064
+#define PAD_ORI	\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 21,21,21"); \
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 22,22,22");\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 23,23,23");\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 24,24,24");\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 25,25,25");\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 26,26,26");\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 27,27,27");\
Mark Wielaard 1cb064
+	__asm__ __volatile__ ("ori 28,28,28");
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
 extern int verbose;
Mark Wielaard 1cb064
 #define debug_printf(X) if (verbose>0) printf(X);
Mark Wielaard 1cb064
 #define debug_show_labels (verbose>0)
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_RT.c b/none/tests/ppc64/test_isa_3_1_R1_RT.c
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..d73b84b10
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_RT.c
Mark Wielaard 1cb064
@@ -0,0 +1,624 @@
Mark Wielaard 1cb064
+/*
Mark Wielaard 1cb064
+ * Valgrind testcase for PowerPC ISA 3.1
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ * Copyright (C) 2019-2020 Will Schmidt <will_schmidt@vnet.ibm.com>
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ * 64bit build:
Mark Wielaard 1cb064
+ *    gcc -Winline -Wall -g -O -mregnames -maltivec -m64
Mark Wielaard 1cb064
+ */
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/*
Mark Wielaard 1cb064
+ *   This program is free software; you can redistribute it and/or
Mark Wielaard 1cb064
+ *   modify it under the terms of the GNU General Public License as
Mark Wielaard 1cb064
+ *   published by the Free Software Foundation; either version 2 of the
Mark Wielaard 1cb064
+ *   License, or (at your option) any later version.
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ *   This program is distributed in the hope that it will be useful,
Mark Wielaard 1cb064
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Mark Wielaard 1cb064
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Mark Wielaard 1cb064
+ *   GNU General Public License for more details.
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ *   You should have received a copy of the GNU General Public License
Mark Wielaard 1cb064
+ *   along with this program; if not, write to the Free Software
Mark Wielaard 1cb064
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Mark Wielaard 1cb064
+ */
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#include <stdio.h>
Mark Wielaard 1cb064
+#ifdef HAS_ISA_3_1
Mark Wielaard 1cb064
+#include <stdint.h>
Mark Wielaard 1cb064
+#include <assert.h>
Mark Wielaard 1cb064
+#include <stdlib.h>
Mark Wielaard 1cb064
+#include <string.h>
Mark Wielaard 1cb064
+#include <unistd.h>
Mark Wielaard 1cb064
+#include <altivec.h>
Mark Wielaard 1cb064
+#include <malloc.h>
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#include <string.h>
Mark Wielaard 1cb064
+#include <signal.h>
Mark Wielaard 1cb064
+#include <setjmp.h>
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* Condition Register fields.
Mark Wielaard 1cb064
+   These are used to capture the condition register values immediately after
Mark Wielaard 1cb064
+   the instruction under test is executed. This is done to help prevent other
Mark Wielaard 1cb064
+   test overhead (switch statements, result compares, etc) from disturbing
Mark Wielaard 1cb064
+   the test case results.  */
Mark Wielaard 1cb064
+unsigned long current_cr;
Mark Wielaard 1cb064
+unsigned long current_fpscr;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+struct test_list_t current_test;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#include "isa_3_1_helpers.h"
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static void test_plxvp_off0_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxvp 20, +0(0),1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxvp_off8_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxvp 20, +8(0),1" );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxvp_off16_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxvp 20, +16(0),1" );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxvp_off24_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxvp 20, +24(0),1" );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxvp_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxvp 20, +32(0),1" );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plbz_off0_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plbz %0, +0(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plbz_off8_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plbz %0, +8(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plbz_off16_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plbz %0, +16(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plbz_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plbz %0, +32(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plbz_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plbz %0, +64(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plhz_off0_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plhz %0, +0(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plhz_off8_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plhz %0, +8(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plhz_off16_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plhz %0, +16(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plhz_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plhz %0, +32(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plhz_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plhz %0, +64(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plha_off0_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plha %0, +0(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plha_off8_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plha %0, +8(0), 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plha_off16_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plha %0, +16(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plha_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plha %0, +32(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plha_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plha %0, +64(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwz_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwz %0, +0(0), 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwz_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwz %0, +8(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwz_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwz %0, +16(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwz_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwz %0, +32(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwz_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwz %0, +64(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwa_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwa %0, +0(0), 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwa_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwa %0, +8(0), 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwa_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwa %0, +16(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwa_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwa %0, +32(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plwa_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plwa %0, +64(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pld_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pld %0, +0(0), 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pld_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pld %0, +8(0), 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pld_off16_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pld %0, +16(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pld_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pld %0, +32(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pld_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pld %0, +64(0), 1" : "=r" (rt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstb_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstb %0, -0x1f400+0(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstb_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstb %0, -0x1f400+8(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstb_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstb %0, -0x1f400+16(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstb_off32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstb %0, -0x1f400+32(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_psth_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("psth %0, -0x1f400+0(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_psth_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("psth %0, -0x1f400+8(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_psth_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("psth %0, -0x1f400+16(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_psth_off32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("psth %0, -0x1f400+32(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstw_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstw %0, -0x1f400+0(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstw_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstw %0, -0x1f400+8(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstw_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstw %0, -0x1f400+16(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstw_off32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstw %0, -0x1f400+32(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstd_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstd %0, -0x1f400+0(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstd_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstd %0, -0x1f400+8(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstd_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstd %0, -0x1f400+16(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstd_off32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstd %0, -0x1f400+32(0), 1" :: "r" (rs) );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+  /* For the paddi tests; although we can get close to a read/write target
Mark Wielaard 1cb064
+     due to forcing where the .text and .bss sections are placed, there is
Mark Wielaard 1cb064
+     still enough codegen variability that having a raw value in the exp
Mark Wielaard 1cb064
+     file will not be determinative for these instructions.
Mark Wielaard 1cb064
+     Thus, compromise and just ensure that the generated value is an
Mark Wielaard 1cb064
+     address that lands within the reloc buffer, and use quasi magic
Mark Wielaard 1cb064
+     eyecatcher values in the return to indicate success.  */
Mark Wielaard 1cb064
+static void test_paddi_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("paddi %0, 0, 0+0, 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+  rt = rt - TEXT_BSS_DELTA;
Mark Wielaard 1cb064
+  if (rt > pcrelative_buff_addr(0) &&
Mark Wielaard 1cb064
+		  rt < pcrelative_buff_addr(RELOC_BUFFER_SIZE))
Mark Wielaard 1cb064
+	  rt = 0xffff0000;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_paddi_12_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("paddi %0, 0, 0+12, 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+  rt = rt - TEXT_BSS_DELTA;
Mark Wielaard 1cb064
+  if (rt > pcrelative_buff_addr(0) &&
Mark Wielaard 1cb064
+		  rt < pcrelative_buff_addr(RELOC_BUFFER_SIZE))
Mark Wielaard 1cb064
+	  rt = 0xffff0012;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_paddi_48_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("paddi %0, 0, 0+48, 1" : "=r" (rt)  );
Mark Wielaard 1cb064
+  rt = rt - TEXT_BSS_DELTA;
Mark Wielaard 1cb064
+  if (rt > pcrelative_buff_addr(0) &&
Mark Wielaard 1cb064
+		  rt < pcrelative_buff_addr(RELOC_BUFFER_SIZE))
Mark Wielaard 1cb064
+	  rt = 0xffff0048;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_paddi_98_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("paddi %0, 0, 0+98, 1" : "=r" (rt) );
Mark Wielaard 1cb064
+  rt = rt - TEXT_BSS_DELTA;
Mark Wielaard 1cb064
+  if (rt > pcrelative_buff_addr(0) &&
Mark Wielaard 1cb064
+		  rt < pcrelative_buff_addr(RELOC_BUFFER_SIZE))
Mark Wielaard 1cb064
+	  rt = 0xffff0098;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plq_off0_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plq 26, +0(0), 1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plq_off8_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plq 26, +8(0), 1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plq_off16_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plq 26, +16(0), 1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plq_off32_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plq 26, +32(0), 1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plq_off48_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plq 26, +48(0), 1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plq_off64_R1 (void) {
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plq 26, +64(0), 1"  );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstq_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstq 24, -0x1f400+0(0), 1"  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstq_off8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstq 24, -0x1f400+8(0), 1"  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstq_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstq 24, -0x1f400+16(0), 1"  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstq_off32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstq 24, -0x1f400+32(0), 1"  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstq_off64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstq 24, -0x1f400+64(0), 1"  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static test_list_t testgroup_generic[] = {
Mark Wielaard 1cb064
+  { &test_paddi_0_R1, "paddi 0_R1", "RT,RA,SI,R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_paddi_12_R1, "paddi 12_R1", "RT,RA,SI,R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_paddi_48_R1, "paddi 48_R1", "RT,RA,SI,R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_paddi_98_R1, "paddi 98_R1", "RT,RA,SI,R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plbz_off0_R1, "plbz off0_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plbz_off8_R1, "plbz off8_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plbz_off16_R1, "plbz off16_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plbz_off32_R1, "plbz off32_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plbz_off64_R1, "plbz off64_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pld_off0_R1, "pld off0_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pld_off8_R1, "pld off8_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pld_off16_R1, "pld off16_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pld_off32_R1, "pld off32_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pld_off64_R1, "pld off64_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plha_off0_R1, "plha off0_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plha_off8_R1, "plha off8_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plha_off16_R1, "plha off16_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plha_off32_R1, "plha off32_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plha_off64_R1, "plha off64_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plhz_off0_R1, "plhz off0_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plhz_off8_R1, "plhz off8_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plhz_off16_R1, "plhz off16_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plhz_off32_R1, "plhz off32_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plhz_off64_R1, "plhz off64_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plq_off0_R1, "plq off0_R1", "RTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plq_off8_R1, "plq off8_R1", "RTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plq_off16_R1, "plq off16_R1", "RTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plq_off32_R1, "plq off32_R1", "RTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plq_off48_R1, "plq off48_R1", "RTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plq_off64_R1, "plq off64_R1", "RTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwa_off0_R1, "plwa off0_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwa_off8_R1, "plwa off8_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwa_off16_R1, "plwa off16_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwa_off32_R1, "plwa off32_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwa_off64_R1, "plwa off64_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwz_off0_R1, "plwz off0_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwz_off8_R1, "plwz off8_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwz_off16_R1, "plwz off16_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwz_off32_R1, "plwz off32_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plwz_off64_R1, "plwz off64_R1", "RT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxvp_off0_R1, "plxvp off0_R1", "XTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxvp_off8_R1, "plxvp off8_R1", "XTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxvp_off16_R1, "plxvp off16_R1", "XTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxvp_off24_R1, "plxvp off24_R1", "XTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxvp_off32_R1, "plxvp off32_R1", "XTp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstb_off0_R1, "pstb off0_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstb_off8_R1, "pstb off8_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstb_off16_R1, "pstb off16_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstb_off32_R1, "pstb off32_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstd_off0_R1, "pstd off0_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstd_off8_R1, "pstd off8_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstd_off16_R1, "pstd off16_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstd_off32_R1, "pstd off32_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_psth_off0_R1, "psth off0_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_psth_off8_R1, "psth off8_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_psth_off16_R1, "psth off16_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_psth_off32_R1, "psth off32_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstq_off0_R1, "pstq off0_R1", "RSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstq_off8_R1, "pstq off8_R1", "RSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstq_off16_R1, "pstq off16_R1", "RSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstq_off32_R1, "pstq off32_R1", "RSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstq_off64_R1, "pstq off64_R1", "RSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstw_off0_R1, "pstw off0_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstw_off8_R1, "pstw off8_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstw_off16_R1, "pstw off16_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstw_off32_R1, "pstw off32_R1", "RS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+	{ NULL, 	    NULL },
Mark Wielaard 1cb064
+};
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/*  Allow skipping of tests. */
Mark Wielaard 1cb064
+unsigned long test_count=0xffff;
Mark Wielaard 1cb064
+unsigned long skip_count=0;
Mark Wielaard 1cb064
+unsigned long setup_only=0;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/*  Set up a setjmp/longjmp to gently handle our SIGILLs and SIGSEGVs.  */
Mark Wielaard 1cb064
+static jmp_buf mybuf;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* This (testfunction_generic) is meant to handle all of the instruction
Mark Wielaard 1cb064
+   variations.  The helpers set up the register and iterator values
Mark Wielaard 1cb064
+   as is appropriate for the instruction being tested.  */
Mark Wielaard 1cb064
+static void testfunction_generic (const char* instruction_name,
Mark Wielaard 1cb064
+				  test_func_t test_function,
Mark Wielaard 1cb064
+				  unsigned int ignore_flags,
Mark Wielaard 1cb064
+				  char * cur_form) {
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   identify_form_components (instruction_name , cur_form);
Mark Wielaard 1cb064
+   debug_show_form (instruction_name, cur_form);
Mark Wielaard 1cb064
+   set_up_iterators ();
Mark Wielaard 1cb064
+   debug_show_iter_ranges ();
Mark Wielaard 1cb064
+   initialize_buffer (0);
Mark Wielaard 1cb064
+   init_pcrelative_write_target ();
Mark Wielaard 1cb064
+   debug_dump_buffer ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   for (vrai = a_start; vrai < a_iters ; vrai+=a_inc) {
Mark Wielaard 1cb064
+      for (vrbi = b_start; vrbi < b_iters ; vrbi+=b_inc) {
Mark Wielaard 1cb064
+	 for (vrci = c_start; vrci < c_iters ; vrci+=c_inc) {
Mark Wielaard 1cb064
+	    for (vrmi = m_start; (vrmi < m_iters) ; vrmi+=m_inc) {
Mark Wielaard 1cb064
+		CHECK_OVERRIDES
Mark Wielaard 1cb064
+		debug_show_current_iteration ();
Mark Wielaard 1cb064
+		// Be sure to initialize the target registers first.
Mark Wielaard 1cb064
+		initialize_target_registers ();
Mark Wielaard 1cb064
+		initialize_source_registers ();
Mark Wielaard 1cb064
+		printf ("%s", instruction_name);
Mark Wielaard 1cb064
+		print_register_header ();
Mark Wielaard 1cb064
+		printf( " =>"); fflush (stdout);
Mark Wielaard 1cb064
+		if (!setup_only) {
Mark Wielaard 1cb064
+		  if (enable_setjmp) {
Mark Wielaard 1cb064
+		   if ( setjmp ( mybuf ) ) {
Mark Wielaard 1cb064
+		     printf("signal tripped. (FIXME)\n");
Mark Wielaard 1cb064
+		     continue;
Mark Wielaard 1cb064
+		   }
Mark Wielaard 1cb064
+		  }
Mark Wielaard 1cb064
+		  (*test_function) ();
Mark Wielaard 1cb064
+		}
Mark Wielaard 1cb064
+		print_register_footer ();
Mark Wielaard 1cb064
+		print_result_buffer ();
Mark Wielaard 1cb064
+		print_pcrelative_write_target ();
Mark Wielaard 1cb064
+		printf ("\n");
Mark Wielaard 1cb064
+	    }
Mark Wielaard 1cb064
+	 }
Mark Wielaard 1cb064
+      }
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+void mykillhandler ( int x ) { longjmp (mybuf, 1); }
Mark Wielaard 1cb064
+void mysegvhandler ( int x ) { longjmp (mybuf, 1); }
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static void do_tests ( void )
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   int groupcount;
Mark Wielaard 1cb064
+   char * cur_form;
Mark Wielaard 1cb064
+   test_group_t group_function = &testfunction_generic;
Mark Wielaard 1cb064
+   test_list_t *tests = testgroup_generic;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   struct sigaction kill_action, segv_action;
Mark Wielaard 1cb064
+   struct sigaction old_kill_action, old_segv_action;
Mark Wielaard 1cb064
+   if (enable_setjmp) {
Mark Wielaard 1cb064
+      kill_action.sa_handler = mykillhandler;
Mark Wielaard 1cb064
+      segv_action.sa_handler = mysegvhandler;
Mark Wielaard 1cb064
+      sigemptyset ( &kill_action.sa_mask );
Mark Wielaard 1cb064
+      sigemptyset ( &segv_action.sa_mask );
Mark Wielaard 1cb064
+      kill_action.sa_flags = SA_NODEFER;
Mark Wielaard 1cb064
+      segv_action.sa_flags = SA_NODEFER;
Mark Wielaard 1cb064
+      sigaction ( SIGILL, &kill_action, &old_kill_action);
Mark Wielaard 1cb064
+      sigaction ( SIGSEGV, &segv_action, &old_segv_action);
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   for (groupcount = 0; tests[groupcount].name != NULL; groupcount++) {
Mark Wielaard 1cb064
+	cur_form = strdup(tests[groupcount].form);
Mark Wielaard 1cb064
+	current_test = tests[groupcount];
Mark Wielaard 1cb064
+	identify_instruction_by_func_name (current_test.name);
Mark Wielaard 1cb064
+	if (groupcount < skip_count) continue;
Mark Wielaard 1cb064
+	if (verbose) printf("Test #%d ,", groupcount);
Mark Wielaard 1cb064
+	if (verbose > 1) printf(" instruction %s (v=%d)", current_test.name, verbose);
Mark Wielaard 1cb064
+	(*group_function) (current_test.name, current_test.func, 0, cur_form );
Mark Wielaard 1cb064
+	printf ("\n");
Mark Wielaard 1cb064
+	if (groupcount >= (skip_count+test_count)) break;
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
+   if (debug_show_labels) printf("\n");
Mark Wielaard 1cb064
+   printf ("All done. Tested %d different instruction groups\n", groupcount);
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static void usage (void)
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   fprintf(stderr,
Mark Wielaard 1cb064
+      "Usage: test_isa_XXX [OPTIONS]\n"
Mark Wielaard 1cb064
+      "\t-h: display this help and exit\n"
Mark Wielaard 1cb064
+      "\t-v: increase verbosity\n"
Mark Wielaard 1cb064
+      "\t-a <foo> : limit number of a-iterations to <foo>\n"
Mark Wielaard 1cb064
+      "\t-b <foo> : limit number of b-iterations to <foo>\n"
Mark Wielaard 1cb064
+      "\t-c <foo> : limit number of c-iterations to <foo>\n"
Mark Wielaard 1cb064
+      "\t-n <foo> : limit to this number of tests.\n"
Mark Wielaard 1cb064
+      "\t-r <foo>: run only test # <foo> \n"
Mark Wielaard 1cb064
+      "\t\n"
Mark Wielaard 1cb064
+      "\t-j :enable setjmp to recover from illegal insns. \n"
Mark Wielaard 1cb064
+      "\t-m :(dev only?) lock VRM value to zero.\n"
Mark Wielaard 1cb064
+      "\t-z :(dev only?) lock MC value to zero.\n"
Mark Wielaard 1cb064
+      "\t-p :(dev only?) disable prefix instructions\n"
Mark Wielaard 1cb064
+      "\t-s <foo>: skip <foo> tests \n"
Mark Wielaard 1cb064
+      "\t-c <foo>: stop after running <foo> # of tests \n"
Mark Wielaard 1cb064
+      "\t-f : Do the test setup but do not actually execute the test instruction. \n"
Mark Wielaard 1cb064
+   );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+int main (int argc, char **argv)
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   int c;
Mark Wielaard 1cb064
+   while ((c = getopt(argc, argv, "dhjvmpfzs:a:b:c:n:r:")) != -1) {
Mark Wielaard 1cb064
+      switch (c) {
Mark Wielaard 1cb064
+	 case 'h':
Mark Wielaard 1cb064
+	    usage();
Mark Wielaard 1cb064
+	    return 0;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	 case 'v':
Mark Wielaard 1cb064
+	    verbose++;
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	 /* Options related to limiting the test iterations.  */
Mark Wielaard 1cb064
+	 case 'a':
Mark Wielaard 1cb064
+	    a_limit=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting a-iters to %ld.\n", a_limit);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'b':
Mark Wielaard 1cb064
+	    b_limit=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting b-iters to %ld.\n", b_limit);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'c':
Mark Wielaard 1cb064
+	    c_limit=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting c-iters to %ld.\n", c_limit);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'n': // run this number of tests.
Mark Wielaard 1cb064
+	    test_count=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting to %ld tests\n", test_count);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'r': // run just test #<foo>.
Mark Wielaard 1cb064
+	    skip_count=atoi (optarg);
Mark Wielaard 1cb064
+	    test_count=0;
Mark Wielaard 1cb064
+	    if (verbose) printf("Running test number %ld\n", skip_count);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 's': // skip this number of tests.
Mark Wielaard 1cb064
+	    skip_count=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("skipping %ld tests\n", skip_count);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	 /* debug options.  */
Mark Wielaard 1cb064
+	 case 'd':
Mark Wielaard 1cb064
+	    dump_tables=1;
Mark Wielaard 1cb064
+	    printf("DEBUG:dump_tables.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'f':
Mark Wielaard 1cb064
+	    setup_only=1;
Mark Wielaard 1cb064
+	    printf("DEBUG:setup_only.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'j':
Mark Wielaard 1cb064
+	    enable_setjmp=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:setjmp enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'm':
Mark Wielaard 1cb064
+	    vrm_override=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:vrm override enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'p':
Mark Wielaard 1cb064
+	    prefix_override=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:prefix override enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'z':
Mark Wielaard 1cb064
+	    mc_override=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:MC override enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 default:
Mark Wielaard 1cb064
+	    usage();
Mark Wielaard 1cb064
+	    fprintf(stderr, "Unknown argument: '%c'\n", c);
Mark Wielaard 1cb064
+	   }
Mark Wielaard 1cb064
+	}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	generic_prologue ();
Mark Wielaard 1cb064
+	build_vsx_table ();
Mark Wielaard 1cb064
+	build_args_table ();
Mark Wielaard 1cb064
+	build_float_vsx_tables ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	if (dump_tables) {
Mark Wielaard 1cb064
+	   dump_float_vsx_tables ();
Mark Wielaard 1cb064
+	   dump_vsxargs ();
Mark Wielaard 1cb064
+	}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	do_tests ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	return 0;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#else	   // HAS_ISA_3_1
Mark Wielaard 1cb064
+int main (int argc, char **argv)
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   printf("NO ISA 3.1 SUPPORT\n");
Mark Wielaard 1cb064
+   return 0;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+#endif
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_RT.stderr.exp b/none/tests/ppc64/test_isa_3_1_R1_RT.stderr.exp
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..139597f9c
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_RT.stderr.exp
Mark Wielaard 1cb064
@@ -0,0 +1,2 @@
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_RT.stdout.exp b/none/tests/ppc64/test_isa_3_1_R1_RT.stdout.exp
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..87594748f
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_RT.stdout.exp
Mark Wielaard 1cb064
@@ -0,0 +1,138 @@
Mark Wielaard 1cb064
+paddi 0_R1 =>         ffff0000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+paddi 12_R1 =>         ffff0012
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+paddi 48_R1 =>         ffff0048
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+paddi 98_R1 =>         ffff0098
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plbz off0_R1 =>               1a
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plbz off8_R1 =>               1f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plbz off16_R1 =>               1f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plbz off32_R1 =>               1b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plbz off64_R1 =>               1b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pld off0_R1 => e740000004100000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pld off8_R1 =>         4e800020
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pld off16_R1 => 6318001862f7001f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pld off32_R1 => 639c001c637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pld off64_R1 => 639c001c637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plha off0_R1 =>               1a
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plha off8_R1 =>               1f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plha off16_R1 =>               1f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plha off32_R1 =>               1b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plha off64_R1 =>               1b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plhz off0_R1 =>               1a
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plhz off8_R1 =>               1f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plhz off16_R1 =>               1f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plhz off32_R1 =>               1b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plhz off64_R1 =>               1b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plq off0_R1 => e34000000410001a 62d6001662b5001f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plq off8_R1 => 62d6001662b5001f 6318001862f7001f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plq off16_R1 => 6318001862f7001f 635a001a6339001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plq off32_R1 => 639c001c637b001b         4e80003b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plq off48_R1 =>               1a 62d6001662b5001f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plq off64_R1 => 639c001c637b001b         4e80003b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwa off0_R1 =>          4100000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwa off8_R1 =>         4e800020
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwa off16_R1 =>                0
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwa off32_R1 =>         637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwa off64_R1 =>         637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwz off0_R1 =>          6100000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwz off8_R1 =>         4e800020
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwz off16_R1 =>                0
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwz off32_R1 =>         637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plwz off64_R1 =>         637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxvp off0_R1 => 6318001862f70017 635a001a63390019 ea80000004100000 62d6001662b50015
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxvp off8_R1 => 635a001a63390019 639c001c637b001b 62d6001662b50015 6318001862f70017
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxvp off16_R1 => 639c001c637b001b 000000004e800020 6318001862f70017 635a001a63390019
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxvp off24_R1 => 000000004e800020 0000000000000000 635a001a63390019 639c001c637b001b
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxvp off32_R1 => 0000000000000000 62d6001662b50015 639c001c637b001b 000000004e800020
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstb off0_R1 102030405060708 => 08              
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstb off8_R1 102030405060708 => 08              
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstb off16_R1 102030405060708 => 08              
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstb off32_R1 102030405060708 => 08              
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstd off0_R1 102030405060708 => 0102030405060708 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstd off8_R1 102030405060708 => 0102030405060708 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstd off16_R1 102030405060708 => 0102030405060708 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstd off32_R1 102030405060708 => 0102030405060708 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+psth off0_R1 102030405060708 => 0708      
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+psth off8_R1 102030405060708 => 0708      
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+psth off16_R1 102030405060708 => 0708      
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+psth off32_R1 102030405060708 => 0708      
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstq off0_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+pstq off0_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstq off8_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+pstq off8_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstq off16_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+pstq off16_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstq off32_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+pstq off32_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstq off64_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+pstq off64_R1 102030405060708 a5b4c3d2e1f00918 => 0102030405060708  a5b4c3d2e1f00918 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstw off0_R1 102030405060708 => 05060708  
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstw off8_R1 102030405060708 => 05060708  
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstw off16_R1 102030405060708 => 05060708  
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstw off32_R1 102030405060708 => 05060708  
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+All done. Tested 66 different instruction groups
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_RT.vgtest b/none/tests/ppc64/test_isa_3_1_R1_RT.vgtest
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..61d7f65a1
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_RT.vgtest
Mark Wielaard 1cb064
@@ -0,0 +1,2 @@
Mark Wielaard 1cb064
+prereq: ../../../tests/check_ppc64_auxv_cap arch_3_1
Mark Wielaard 1cb064
+prog: test_isa_3_1_R1_RT
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_XT.c b/none/tests/ppc64/test_isa_3_1_R1_XT.c
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..58885b8d3
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_XT.c
Mark Wielaard 1cb064
@@ -0,0 +1,534 @@
Mark Wielaard 1cb064
+/*
Mark Wielaard 1cb064
+ * Valgrind testcase for PowerPC ISA 3.1
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ * Copyright (C) 2019-2020 Will Schmidt <will_schmidt@vnet.ibm.com>
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ * 64bit build:
Mark Wielaard 1cb064
+ *    gcc -Winline -Wall -g -O -mregnames -maltivec -m64
Mark Wielaard 1cb064
+ */
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/*
Mark Wielaard 1cb064
+ *   This program is free software; you can redistribute it and/or
Mark Wielaard 1cb064
+ *   modify it under the terms of the GNU General Public License as
Mark Wielaard 1cb064
+ *   published by the Free Software Foundation; either version 2 of the
Mark Wielaard 1cb064
+ *   License, or (at your option) any later version.
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ *   This program is distributed in the hope that it will be useful,
Mark Wielaard 1cb064
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Mark Wielaard 1cb064
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Mark Wielaard 1cb064
+ *   GNU General Public License for more details.
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ *   You should have received a copy of the GNU General Public License
Mark Wielaard 1cb064
+ *   along with this program; if not, write to the Free Software
Mark Wielaard 1cb064
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Mark Wielaard 1cb064
+ */
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#include <stdio.h>
Mark Wielaard 1cb064
+#ifdef HAS_ISA_3_1
Mark Wielaard 1cb064
+#include <stdint.h>
Mark Wielaard 1cb064
+#include <assert.h>
Mark Wielaard 1cb064
+#include <stdlib.h>
Mark Wielaard 1cb064
+#include <string.h>
Mark Wielaard 1cb064
+#include <unistd.h>
Mark Wielaard 1cb064
+#include <altivec.h>
Mark Wielaard 1cb064
+#include <malloc.h>
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#include <string.h>
Mark Wielaard 1cb064
+#include <signal.h>
Mark Wielaard 1cb064
+#include <setjmp.h>
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* Condition Register fields.
Mark Wielaard 1cb064
+   These are used to capture the condition register values immediately after
Mark Wielaard 1cb064
+   the instruction under test is executed. This is done to help prevent other
Mark Wielaard 1cb064
+   test overhead (switch statements, result compares, etc) from disturbing
Mark Wielaard 1cb064
+   the test case results.  */
Mark Wielaard 1cb064
+unsigned long current_cr;
Mark Wielaard 1cb064
+unsigned long current_fpscr;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+struct test_list_t current_test;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#include "isa_3_1_helpers.h"
Mark Wielaard 1cb064
+static void test_pstxvp_off0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxvp 20, -0x1f400+0(0),1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxvp_off16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxvp 20, -0x1f400+16(0),1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxvp_off32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxvp 20, -0x1f400+32(0),1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxvp_off48_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxvp 20, -0x1f400+48(0),1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfd_64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfd 28, +64(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfd_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfd 28, +32(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfd_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfd 28, +16(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfd_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfd 28, +8(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfd_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfd 28, +4(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfd_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfd 28, +0(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfs_64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfs 28, +64(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfs_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfs 28, +32(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfs_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfs 28, +16(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfs_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfs 28, +8(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfs_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfs 28, +4(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plfs_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plfs 28, +0(0), 1");
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfd_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfd 26, -0x1f400+32(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfd_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfd 26, -0x1f400+16(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfd_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfd 26, -0x1f400+8(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfd_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfd 26, -0x1f400+4(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfd_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfd 26, -0x1f400+0(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfs_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfs 26, -0x1f400+32(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfs_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfs 26, -0x1f400+16(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfs_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfs 26, -0x1f400+8(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfs_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfs 26, -0x1f400+4(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstfs_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstfs 26, -0x1f400+0(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxsd_64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxsd %0, +64(0), 1" : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxsd_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; plxsd %0, +32(0), 1" : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxsd_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxsd %0, +16(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxsd_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxsd %0, +8(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxsd_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxsd %0, +4(0), 1; pnop;pnop;pnop; "  : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxsd_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxsd %0, +0(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxssp_64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxssp %0, +64(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxssp_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxssp %0, +32(0), 1; pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxssp_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxssp %0, +16(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxssp_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxssp %0, +8(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxssp_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxssp %0, +4(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxssp_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxssp %0, +0(0), 1; pnop;pnop;pnop; " : "=v" (vrt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+/* Follow the short-range plxv instructions with nop in order to
Mark Wielaard 1cb064
+   pad out subsequent instructions.  When written there are found
Mark Wielaard 1cb064
+   to be fluctuations in the instructions to store the result back
Mark Wielaard 1cb064
+   into the target variable.  (pla,pstxv...).
Mark Wielaard 1cb064
+   */
Mark Wielaard 1cb064
+static void test_plxv_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxv %x0, +16(0), 1; pnop;pnop;pnop;" : "=wa" (vec_xt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxv_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxv %x0, +8(0), 1; pnop;pnop;pnop;" : "=wa" (vec_xt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxv_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxv %x0, +4(0), 1; pnop;pnop;pnop;" : "=wa" (vec_xt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_plxv_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("plxv %x0, +0(0), 1; pnop;pnop;pnop; " : "=wa" (vec_xt) );
Mark Wielaard 1cb064
+	PAD_ORI
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxsd_64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; pstxsd 22, -0x1f400+64(0), 1" );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxsd_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; pstxsd 22, -0x1f400+32(0), 1" );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxsd_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; pstxsd 22, -0x1f400+16(0), 1" );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxsd_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; pstxsd 22, -0x1f400+8(0), 1" );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxsd_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; pstxsd 22, -0x1f400+4(0), 1"  );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxsd_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ (".align 2 ; pstxsd 22, -0x1f400+0(0), 1" );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxssp_64_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxssp 22, -0x1f400+64(0), 1" );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxssp_32_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxssp 22, -0x1f400+32(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxssp_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxssp 22, -0x1f400+16(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxssp_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxssp 22, -0x1f400+8(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxssp_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxssp 22, -0x1f400+4(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxssp_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxssp 22, -0x1f400+0(0), 1");
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxv_16_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxv %x0, -0x1f400+16(0), 1" :: "wa" (vec_xs));
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxv_8_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxv %x0, -0x1f400+8(0), 1" :: "wa" (vec_xs));
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxv_4_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxv %x0, -0x1f400+4(0), 1" :: "wa" (vec_xs));
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+static void test_pstxv_0_R1 (void) {
Mark Wielaard 1cb064
+  __asm__ __volatile__ ("pstxv %x0, -0x1f400+0(0), 1" :: "wa" (vec_xs));
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static test_list_t testgroup_generic[] = {
Mark Wielaard 1cb064
+  { &test_plfd_0_R1, "plfd 0_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfd_4_R1, "plfd 4_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfd_8_R1, "plfd 8_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfd_16_R1, "plfd 16_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfd_32_R1, "plfd 32_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfd_64_R1, "plfd 64_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfs_0_R1, "plfs 0_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfs_4_R1, "plfs 4_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfs_8_R1, "plfs 8_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfs_16_R1, "plfs 16_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfs_32_R1, "plfs 32_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plfs_64_R1, "plfs 64_R1", "FRT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxsd_0_R1, "plxsd 0_R1", "VRT,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxsd_4_R1, "plxsd 4_R1", "VRT,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxsd_8_R1, "plxsd 8_R1", "VRT,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxsd_16_R1, "plxsd 16_R1", "VRT,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxsd_32_R1, "plxsd 32_R1", "VRT,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxsd_64_R1, "plxsd 64_R1", "VRT,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxssp_0_R1, "plxssp 0_R1", "VRT,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxssp_4_R1, "plxssp 4_R1", "VRT,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxssp_8_R1, "plxssp 8_R1", "VRT,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxssp_16_R1, "plxssp 16_R1", "VRT,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxssp_32_R1, "plxssp 32_R1", "VRT,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxssp_64_R1, "plxssp 64_R1", "VRT,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxv_0_R1, "plxv 0_R1", "XT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxv_4_R1, "plxv 4_R1", "XT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxv_8_R1, "plxv 8_R1", "XT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_plxv_16_R1, "plxv 16_R1", "XT,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfd_0_R1, "pstfd 0_R1", "FRS,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfd_4_R1, "pstfd 4_R1", "FRS,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfd_8_R1, "pstfd 8_R1", "FRS,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfd_16_R1, "pstfd 16_R1", "FRS,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfd_32_R1, "pstfd 32_R1", "FRS,D(RA),R", 0b00110000}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfs_0_R1, "pstfs 0_R1", "FRS,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfs_4_R1, "pstfs 4_R1", "FRS,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfs_8_R1, "pstfs 8_R1", "FRS,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfs_16_R1, "pstfs 16_R1", "FRS,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstfs_32_R1, "pstfs 32_R1", "FRS,D(RA),R", 0b00001111}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxsd_0_R1, "pstxsd 0_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxsd_4_R1, "pstxsd 4_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxsd_8_R1, "pstxsd 8_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxsd_16_R1, "pstxsd 16_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxsd_32_R1, "pstxsd 32_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxsd_64_R1, "pstxsd 64_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxssp_0_R1, "pstxssp 0_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxssp_4_R1, "pstxssp 4_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxssp_8_R1, "pstxssp 8_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxssp_16_R1, "pstxssp 16_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxssp_32_R1, "pstxssp 32_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxssp_64_R1, "pstxssp 64_R1", "VRS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxvp_off0_R1, "pstxvp off0_R1", "XSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxvp_off16_R1, "pstxvp off16_R1", "XSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxvp_off32_R1, "pstxvp off32_R1", "XSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxvp_off48_R1, "pstxvp off48_R1", "XSp,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxv_0_R1, "pstxv 0_R1", "XS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxv_4_R1, "pstxv 4_R1", "XS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxv_8_R1, "pstxv 8_R1", "XS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+  { &test_pstxv_16_R1, "pstxv 16_R1", "XS,D(RA),R"}, /* bcwp */
Mark Wielaard 1cb064
+	{ NULL, 	    NULL },
Mark Wielaard 1cb064
+};
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/*  Allow skipping of tests. */
Mark Wielaard 1cb064
+unsigned long test_count=0xffff;
Mark Wielaard 1cb064
+unsigned long skip_count=0;
Mark Wielaard 1cb064
+unsigned long setup_only=0;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/*  Set up a setjmp/longjmp to gently handle our SIGILLs and SIGSEGVs.  */
Mark Wielaard 1cb064
+static jmp_buf mybuf;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* This (testfunction_generic) is meant to handle all of the instruction
Mark Wielaard 1cb064
+   variations.  The helpers set up the register and iterator values
Mark Wielaard 1cb064
+   as is appropriate for the instruction being tested.  */
Mark Wielaard 1cb064
+static void testfunction_generic (const char* instruction_name,
Mark Wielaard 1cb064
+				  test_func_t test_function,
Mark Wielaard 1cb064
+				  unsigned int ignore_flags,
Mark Wielaard 1cb064
+				  char * cur_form) {
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   identify_form_components (instruction_name , cur_form);
Mark Wielaard 1cb064
+   debug_show_form (instruction_name, cur_form);
Mark Wielaard 1cb064
+   set_up_iterators ();
Mark Wielaard 1cb064
+   debug_show_iter_ranges ();
Mark Wielaard 1cb064
+   initialize_buffer (0);
Mark Wielaard 1cb064
+   init_pcrelative_write_target ();
Mark Wielaard 1cb064
+   debug_dump_buffer ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   for (vrai = a_start; vrai < a_iters ; vrai+=a_inc) {
Mark Wielaard 1cb064
+      for (vrbi = b_start; vrbi < b_iters ; vrbi+=b_inc) {
Mark Wielaard 1cb064
+	 for (vrci = c_start; vrci < c_iters ; vrci+=c_inc) {
Mark Wielaard 1cb064
+	    for (vrmi = m_start; (vrmi < m_iters) ; vrmi+=m_inc) {
Mark Wielaard 1cb064
+		CHECK_OVERRIDES
Mark Wielaard 1cb064
+		debug_show_current_iteration ();
Mark Wielaard 1cb064
+		// Be sure to initialize the target registers first.
Mark Wielaard 1cb064
+		initialize_target_registers ();
Mark Wielaard 1cb064
+		initialize_source_registers ();
Mark Wielaard 1cb064
+		vec_xa[0]=0x1234;
Mark Wielaard 1cb064
+		vec_xa[1]=0x4567;
Mark Wielaard 1cb064
+		printf ("%s", instruction_name);
Mark Wielaard 1cb064
+		print_register_header ();
Mark Wielaard 1cb064
+		printf( " =>"); fflush (stdout);
Mark Wielaard 1cb064
+		if (!setup_only) {
Mark Wielaard 1cb064
+		  if (enable_setjmp) {
Mark Wielaard 1cb064
+		   if ( setjmp ( mybuf ) ) {
Mark Wielaard 1cb064
+		     printf("signal tripped. (FIXME)\n");
Mark Wielaard 1cb064
+		     continue;
Mark Wielaard 1cb064
+		   }
Mark Wielaard 1cb064
+		  }
Mark Wielaard 1cb064
+		  (*test_function) ();
Mark Wielaard 1cb064
+		}
Mark Wielaard 1cb064
+		print_register_footer ();
Mark Wielaard 1cb064
+		print_result_buffer ();
Mark Wielaard 1cb064
+		print_pcrelative_write_target ();
Mark Wielaard 1cb064
+		printf ("\n");
Mark Wielaard 1cb064
+	    }
Mark Wielaard 1cb064
+	 }
Mark Wielaard 1cb064
+      }
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+void mykillhandler ( int x ) { longjmp (mybuf, 1); }
Mark Wielaard 1cb064
+void mysegvhandler ( int x ) { longjmp (mybuf, 1); }
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static void do_tests ( void )
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   int groupcount;
Mark Wielaard 1cb064
+   char * cur_form;
Mark Wielaard 1cb064
+   test_group_t group_function = &testfunction_generic;
Mark Wielaard 1cb064
+   test_list_t *tests = testgroup_generic;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   struct sigaction kill_action, segv_action;
Mark Wielaard 1cb064
+   struct sigaction old_kill_action, old_segv_action;
Mark Wielaard 1cb064
+   if (enable_setjmp) {
Mark Wielaard 1cb064
+      kill_action.sa_handler = mykillhandler;
Mark Wielaard 1cb064
+      segv_action.sa_handler = mysegvhandler;
Mark Wielaard 1cb064
+      sigemptyset ( &kill_action.sa_mask );
Mark Wielaard 1cb064
+      sigemptyset ( &segv_action.sa_mask );
Mark Wielaard 1cb064
+      kill_action.sa_flags = SA_NODEFER;
Mark Wielaard 1cb064
+      segv_action.sa_flags = SA_NODEFER;
Mark Wielaard 1cb064
+      sigaction ( SIGILL, &kill_action, &old_kill_action);
Mark Wielaard 1cb064
+      sigaction ( SIGSEGV, &segv_action, &old_segv_action);
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   for (groupcount = 0; tests[groupcount].name != NULL; groupcount++) {
Mark Wielaard 1cb064
+	cur_form = strdup(tests[groupcount].form);
Mark Wielaard 1cb064
+	current_test = tests[groupcount];
Mark Wielaard 1cb064
+	identify_instruction_by_func_name (current_test.name);
Mark Wielaard 1cb064
+	if (groupcount < skip_count) continue;
Mark Wielaard 1cb064
+	if (verbose) printf("Test #%d ,", groupcount);
Mark Wielaard 1cb064
+	if (verbose > 1) printf(" instruction %s (v=%d)", current_test.name, verbose);
Mark Wielaard 1cb064
+	(*group_function) (current_test.name, current_test.func, 0, cur_form );
Mark Wielaard 1cb064
+	printf ("\n");
Mark Wielaard 1cb064
+	if (groupcount >= (skip_count+test_count)) break;
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
+   if (debug_show_labels) printf("\n");
Mark Wielaard 1cb064
+   printf ("All done. Tested %d different instruction groups\n", groupcount);
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+static void usage (void)
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   fprintf(stderr,
Mark Wielaard 1cb064
+      "Usage: test_isa_XXX [OPTIONS]\n"
Mark Wielaard 1cb064
+      "\t-h: display this help and exit\n"
Mark Wielaard 1cb064
+      "\t-v: increase verbosity\n"
Mark Wielaard 1cb064
+      "\t-a <foo> : limit number of a-iterations to <foo>\n"
Mark Wielaard 1cb064
+      "\t-b <foo> : limit number of b-iterations to <foo>\n"
Mark Wielaard 1cb064
+      "\t-c <foo> : limit number of c-iterations to <foo>\n"
Mark Wielaard 1cb064
+      "\t-n <foo> : limit to this number of tests.\n"
Mark Wielaard 1cb064
+      "\t-r <foo>: run only test # <foo> \n"
Mark Wielaard 1cb064
+      "\t\n"
Mark Wielaard 1cb064
+      "\t-j :enable setjmp to recover from illegal insns. \n"
Mark Wielaard 1cb064
+      "\t-m :(dev only?) lock VRM value to zero.\n"
Mark Wielaard 1cb064
+      "\t-z :(dev only?) lock MC value to zero.\n"
Mark Wielaard 1cb064
+      "\t-p :(dev only?) disable prefix instructions\n"
Mark Wielaard 1cb064
+      "\t-s <foo>: skip <foo> tests \n"
Mark Wielaard 1cb064
+      "\t-c <foo>: stop after running <foo> # of tests \n"
Mark Wielaard 1cb064
+      "\t-f : Do the test setup but do not actually execute the test instruction. \n"
Mark Wielaard 1cb064
+   );
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+int main (int argc, char **argv)
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   int c;
Mark Wielaard 1cb064
+   while ((c = getopt(argc, argv, "dhjvmpfzs:a:b:c:n:r:")) != -1) {
Mark Wielaard 1cb064
+      switch (c) {
Mark Wielaard 1cb064
+	 case 'h':
Mark Wielaard 1cb064
+	    usage();
Mark Wielaard 1cb064
+	    return 0;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	 case 'v':
Mark Wielaard 1cb064
+	    verbose++;
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	 /* Options related to limiting the test iterations.  */
Mark Wielaard 1cb064
+	 case 'a':
Mark Wielaard 1cb064
+	    a_limit=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting a-iters to %ld.\n", a_limit);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'b':
Mark Wielaard 1cb064
+	    b_limit=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting b-iters to %ld.\n", b_limit);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'c':
Mark Wielaard 1cb064
+	    c_limit=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting c-iters to %ld.\n", c_limit);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'n': // run this number of tests.
Mark Wielaard 1cb064
+	    test_count=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("limiting to %ld tests\n", test_count);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'r': // run just test #<foo>.
Mark Wielaard 1cb064
+	    skip_count=atoi (optarg);
Mark Wielaard 1cb064
+	    test_count=0;
Mark Wielaard 1cb064
+	    if (verbose) printf("Running test number %ld\n", skip_count);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 's': // skip this number of tests.
Mark Wielaard 1cb064
+	    skip_count=atoi (optarg);
Mark Wielaard 1cb064
+	    printf ("skipping %ld tests\n", skip_count);
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	 /* debug options.  */
Mark Wielaard 1cb064
+	 case 'd':
Mark Wielaard 1cb064
+	    dump_tables=1;
Mark Wielaard 1cb064
+	    printf("DEBUG:dump_tables.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'f':
Mark Wielaard 1cb064
+	    setup_only=1;
Mark Wielaard 1cb064
+	    printf("DEBUG:setup_only.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'j':
Mark Wielaard 1cb064
+	    enable_setjmp=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:setjmp enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'm':
Mark Wielaard 1cb064
+	    vrm_override=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:vrm override enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'p':
Mark Wielaard 1cb064
+	    prefix_override=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:prefix override enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 case 'z':
Mark Wielaard 1cb064
+	    mc_override=1;
Mark Wielaard 1cb064
+	    printf ("DEBUG:MC override enabled.\n");
Mark Wielaard 1cb064
+	    break;
Mark Wielaard 1cb064
+	 default:
Mark Wielaard 1cb064
+	    usage();
Mark Wielaard 1cb064
+	    fprintf(stderr, "Unknown argument: '%c'\n", c);
Mark Wielaard 1cb064
+	   }
Mark Wielaard 1cb064
+	}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	generic_prologue ();
Mark Wielaard 1cb064
+	build_vsx_table ();
Mark Wielaard 1cb064
+	build_args_table ();
Mark Wielaard 1cb064
+	build_float_vsx_tables ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	if (dump_tables) {
Mark Wielaard 1cb064
+	   dump_float_vsx_tables ();
Mark Wielaard 1cb064
+	   dump_vsxargs ();
Mark Wielaard 1cb064
+	}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	do_tests ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+	return 0;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+#else	   // HAS_ISA_3_1
Mark Wielaard 1cb064
+int main (int argc, char **argv)
Mark Wielaard 1cb064
+{
Mark Wielaard 1cb064
+   printf("NO ISA 3.1 SUPPORT\n");
Mark Wielaard 1cb064
+   return 0;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+#endif
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_XT.stderr.exp b/none/tests/ppc64/test_isa_3_1_R1_XT.stderr.exp
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..139597f9c
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_XT.stderr.exp
Mark Wielaard 1cb064
@@ -0,0 +1,2 @@
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_XT.stdout.exp b/none/tests/ppc64/test_isa_3_1_R1_XT.stdout.exp
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..48d591f4d
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_XT.stdout.exp
Mark Wielaard 1cb064
@@ -0,0 +1,127 @@
Mark Wielaard 1cb064
+plfd 0_R1 =>_ -4.903986e+55 _  cb80000006100000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfd 4_R1 =>_ 3.095878e+167 _  62b50015cb800004, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfd 8_R1 =>_ 1.297320e+168 _  62d6001662b50015, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfd 16_R1 =>_ 2.264413e+169 _  6318001862f70017, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfd 32_R1 =>_ 6.763045e+171 _  639c001c637b001b, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfd 64_R1 =>_ 6.763045e+171 _  639c001c637b001b, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfs 0_R1 =>_ 2.708339e-35 _  38c2000000000000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfs 4_R1 =>_ -2.560001e+02 _  c070000080000000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfs 8_R1 =>_ 1.669433e+21 _  4456a002a0000000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfs 16_R1 =>_ 2.278176e+21 _  445ee002e0000000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfs 32_R1 =>_ 4.630140e+21 _  446f600360000000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plfs 64_R1 =>_ 4.630140e+21 _  446f600360000000, 0 
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxsd 0_R1 => a800000004100000,0000000000000000 -5.07588375e-116            +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxsd 4_R1 =>  7000000a8000004,0000000000000000  5.77662562e-275            +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxsd 8_R1 =>  700000060000000,0000000000000000  5.77662407e-275            +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxsd 16_R1 =>          7000000,0000000000000000             +Den            +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxsd 32_R1 => 6339001963180018,0000000000000000  9.43505226e+169            +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxsd 64_R1 => 6339001963180018,0000000000000000  9.43505226e+169            +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxssp 0_R1 => 3882000000000000,0000000000000000     6.19888e-05           +Zero           +Zero           +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxssp 4_R1 => bd80000080000000,0000000000000000    -6.25000e-02           -Zero           +Zero           +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxssp 8_R1 => 38e0000000000000,0000000000000000     1.06812e-04           +Zero           +Zero           +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxssp 16_R1 => 38e0000000000000,0000000000000000     1.06812e-04           +Zero           +Zero           +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxssp 32_R1 => 445ac002c0000000,0000000000000000     8.75000e+02    -2.00000e+00           +Zero           +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxssp 64_R1 => 446b400340000000,0000000000000000     9.41000e+02     2.00000e+00           +Zero           +Zero
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxv 0_R1 => c800000004100000          7000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxv 4_R1 =>  7000000c8000004  700000000000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxv 8_R1 =>          7000000          7000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+plxv 16_R1 =>          7000000          7000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfd 0_R1 43dfe000003fe000 43eff000000ff000 => e000003fe00043df
Mark Wielaard 1cb064
+pstfd 0_R1 43eff000000ff000 43efefffffcff000 => f000000ff00043ef
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfd 4_R1 43dfe000003fe000 43eff000000ff000 =>     e000003f e00043df    
Mark Wielaard 1cb064
+pstfd 4_R1 43eff000000ff000 43efefffffcff000 =>     f000000f f00043ef    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfd 8_R1 43dfe000003fe000 43eff000000ff000 => e000003fe00043df
Mark Wielaard 1cb064
+pstfd 8_R1 43eff000000ff000 43efefffffcff000 => f000000ff00043ef
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfd 16_R1 43dfe000003fe000 43eff000000ff000 => e000003fe00043df
Mark Wielaard 1cb064
+pstfd 16_R1 43eff000000ff000 43efefffffcff000 => f000000ff00043ef
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfd 32_R1 43dfe000003fe000 43eff000000ff000 => e000003fe00043df
Mark Wielaard 1cb064
+pstfd 32_R1 43eff000000ff000 43efefffffcff000 => f000000ff00043ef
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfs 0_R1 000000005eff0000 000000005f7f8000 => 00005eff    
Mark Wielaard 1cb064
+pstfs 0_R1 000000005f7f8000 000000005f7f8000 => 80005f7f    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfs 4_R1 000000005eff0000 000000005f7f8000 =>     00005eff
Mark Wielaard 1cb064
+pstfs 4_R1 000000005f7f8000 000000005f7f8000 =>     80005f7f
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfs 8_R1 000000005eff0000 000000005f7f8000 => 00005eff    
Mark Wielaard 1cb064
+pstfs 8_R1 000000005f7f8000 000000005f7f8000 => 80005f7f    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfs 16_R1 000000005eff0000 000000005f7f8000 => 00005eff    
Mark Wielaard 1cb064
+pstfs 16_R1 000000005f7f8000 000000005f7f8000 => 80005f7f    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstfs 32_R1 000000005eff0000 000000005f7f8000 => 00005eff    
Mark Wielaard 1cb064
+pstfs 32_R1 000000005f7f8000 000000005f7f8000 => 80005f7f    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxsd 0_R1 => 0000000000000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxsd 4_R1 =>     00000000 00000000    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxsd 8_R1 => 0000000000000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxsd 16_R1 => 0000000000000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxsd 32_R1 => 0000000000000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxsd 64_R1 => 0000000000000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxssp 0_R1 => 00000000    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxssp 4_R1 =>     00000000
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxssp 8_R1 => 00000000    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxssp 16_R1 => 00000000    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxssp 32_R1 => 00000000    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxssp 64_R1 => 00000000    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxvp off0_R1 0180055e0180077e 0080000e8080000e ff7ffffe7f7ffffe ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80 077e0180055e0180 000e8080000e0080
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxvp off16_R1 0180055e0180077e 0080000e8080000e ff7ffffe7f7ffffe ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80 077e0180055e0180 000e8080000e0080
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxvp off32_R1 0180055e0180077e 0080000e8080000e ff7ffffe7f7ffffe ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80 077e0180055e0180 000e8080000e0080
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxvp off48_R1 0180055e0180077e 0080000e8080000e ff7ffffe7f7ffffe ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80 077e0180055e0180 000e8080000e0080
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxv 0_R1 ff7ffffe7f7ffffe,ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxv 4_R1 ff7ffffe7f7ffffe,ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxv 8_R1 ff7ffffe7f7ffffe,ff8000007f800000 => fffe7f7ffffeff7f 00007f800000ff80
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+pstxv 16_R1 ff7ffffe7f7ffffe,ff8000007f800000 =>     fffe7f7f fffeff7f00007f80 0000ff80    
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+All done. Tested 58 different instruction groups
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_R1_XT.vgtest b/none/tests/ppc64/test_isa_3_1_R1_XT.vgtest
Mark Wielaard 1cb064
new file mode 100644
Mark Wielaard 1cb064
index 000000000..7331aafad
Mark Wielaard 1cb064
--- /dev/null
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_R1_XT.vgtest
Mark Wielaard 1cb064
@@ -0,0 +1,2 @@
Mark Wielaard 1cb064
+prereq: ../../../tests/check_ppc64_auxv_cap arch_3_1
Mark Wielaard 1cb064
+prog: test_isa_3_1_R1_XT
Mark Wielaard 1cb064
diff --git a/none/tests/ppc64/test_isa_3_1_common.c b/none/tests/ppc64/test_isa_3_1_common.c
Mark Wielaard 1cb064
index 7c3dc6f00..b3320277b 100644
Mark Wielaard 1cb064
--- a/none/tests/ppc64/test_isa_3_1_common.c
Mark Wielaard 1cb064
+++ b/none/tests/ppc64/test_isa_3_1_common.c
Mark Wielaard 1cb064
@@ -134,11 +134,13 @@ bool uses_acc_vsrs;
Mark Wielaard 1cb064
 bool uses_pmsk;
Mark Wielaard 1cb064
 bool uses_buffer;  // Buffer related.
Mark Wielaard 1cb064
 bool uses_load_buffer, uses_store_buffer, uses_any_buffer;
Mark Wielaard 1cb064
+bool updates_byte, updates_halfword, updates_word; // output helpers.
Mark Wielaard 1cb064
 bool uses_quad;
Mark Wielaard 1cb064
 unsigned long output_mask;  // Output field special handling.
Mark Wielaard 1cb064
 bool instruction_is_sp, instruction_is_sp_estimate;
Mark Wielaard 1cb064
 bool instruction_is_dp, instruction_is_dp_estimate;
Mark Wielaard 1cb064
 bool instruction_is_b16;
Mark Wielaard 1cb064
+bool instruction_is_relative;
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
 unsigned long long min (unsigned long long a, unsigned long long b) {
Mark Wielaard 1cb064
    if ( a < b )
Mark Wielaard 1cb064
@@ -236,6 +238,18 @@ void identify_form_components (const char *instruction_name,
Mark Wielaard 1cb064
       (strncmp (instruction_name, "pmst", 4) == 0) ||
Mark Wielaard 1cb064
       (strncmp (instruction_name, "pst", 3) == 0) ||
Mark Wielaard 1cb064
       (strncmp (instruction_name, "st", 2) == 0));
Mark Wielaard 1cb064
+   updates_byte = (
Mark Wielaard 1cb064
+      (strncmp (instruction_name, "pstb", 4) == 0) );
Mark Wielaard 1cb064
+   updates_halfword = (
Mark Wielaard 1cb064
+      (strncmp (instruction_name, "psth", 4) == 0) ||
Mark Wielaard 1cb064
+       (strncmp (instruction_name, "pstfs", 4) == 0) ||
Mark Wielaard 1cb064
+       (strncmp (instruction_name, "pstxsd", 4) == 0) ||
Mark Wielaard 1cb064
+       (strncmp (instruction_name, "pstxssp", 4) == 0) ||
Mark Wielaard 1cb064
+       (strncmp (instruction_name, "pstxv", 4) == 0) ||
Mark Wielaard 1cb064
+       (strncmp (instruction_name, "psfs", 4) == 0) );
Mark Wielaard 1cb064
+   updates_word = (
Mark Wielaard 1cb064
+      (strncmp (instruction_name, "pstw", 4) == 0) );
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
    uses_any_buffer = (strstr (cur_form, "(RA)") != NULL);
Mark Wielaard 1cb064
    uses_buffer = uses_any_buffer||uses_load_buffer||uses_store_buffer;
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
@@ -268,6 +282,15 @@ void identify_form_components (const char *instruction_name,
Mark Wielaard 1cb064
    instruction_is_b16 =         ( current_test.mask & B16_MASK        );
Mark Wielaard 1cb064
 }
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
+/* Parse the provided function name to set assorted values.
Mark Wielaard 1cb064
+   In particular, set an indicator when the instruction test has
Mark Wielaard 1cb064
+   indicated it will run with R==1 that indicates it is a PC-relative
Mark Wielaard 1cb064
+   instruction.  Those tests should all have "_R1" as part of
Mark Wielaard 1cb064
+   the function name.  */
Mark Wielaard 1cb064
+void identify_instruction_by_func_name(const char * function_name) {
Mark Wielaard 1cb064
+   instruction_is_relative = ( (strstr (function_name, "R1") != NULL));
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
 void display_form_components (char * cur_form) {
Mark Wielaard 1cb064
    printf (" %s\n", cur_form);
Mark Wielaard 1cb064
    printf ("Instruction form elements: ");
Mark Wielaard 1cb064
@@ -288,7 +311,7 @@ void display_form_components (char * cur_form) {
Mark Wielaard 1cb064
    if (has_frbp) printf ("frbp ");
Mark Wielaard 1cb064
    if (has_frs)  printf ("frs ");
Mark Wielaard 1cb064
    if (has_frsp) printf ("frsp ");
Mark Wielaard 1cb064
-   if (has_frt)  printf ("frt ");
Mark Wielaard 1cb064
+   if (has_frt)  printf ("frt%s ",(instruction_is_relative)?"-raw":"");
Mark Wielaard 1cb064
    if (has_frtp) printf ("frtp ");
Mark Wielaard 1cb064
    if (has_xa)   printf ("xa ");
Mark Wielaard 1cb064
    if (has_xap)  printf ("xap ");
Mark Wielaard 1cb064
@@ -298,6 +321,7 @@ void display_form_components (char * cur_form) {
Mark Wielaard 1cb064
    if (has_xsp)  printf ("xsp ");
Mark Wielaard 1cb064
    if (has_xt)   printf ("xt ");
Mark Wielaard 1cb064
    if (has_xtp)  printf ("xtp ");
Mark Wielaard 1cb064
+   if (instruction_is_relative)  printf ("R==1 ");
Mark Wielaard 1cb064
    if (uses_acc_src) printf ("AS ");
Mark Wielaard 1cb064
    if (uses_acc_dest) printf ("AT ");
Mark Wielaard 1cb064
    printf ("\n");
Mark Wielaard 1cb064
@@ -991,6 +1015,107 @@ if (debug_show_values) printf (" buffer:");
Mark Wielaard 1cb064
   }
Mark Wielaard 1cb064
 }
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
+/* **** Reloc Buffer **************************************** */
Mark Wielaard 1cb064
+/* Create a large buffer to be the destination for pc-relative
Mark Wielaard 1cb064
+ * writes.  This test is built with linker hints in order
Mark Wielaard 1cb064
+ * to ensure our buffer, stored in the .bss section, is at a
Mark Wielaard 1cb064
+ * mostly known offset from the instructions being exercised,
Mark Wielaard 1cb064
+ * so a hardcoded offset from the PC (pc-relative) will be
Mark Wielaard 1cb064
+ * on-target.
Mark Wielaard 1cb064
+ * If there are significant reworks to the code, the bss or
Mark Wielaard 1cb064
+ * text sections, or the offsets used may need to change.
Mark Wielaard 1cb064
+ *
Mark Wielaard 1cb064
+ * The linker hints are specifically -Tbss and -Ttext.
Mark Wielaard 1cb064
+ * gcc foo.c test_isa_3_1_common.c -I../../../   -Wl,-Tbss 0x20000 -Wl,-Ttext 0x40000
Mark Wielaard 1cb064
+ */
Mark Wielaard 1cb064
+ /* RELOC_BUFFER_SIZE is defined to 0x1000 in isa_3_1_helpers.h  */
Mark Wielaard 1cb064
+#define RELOC_BUFFER_PATTERN 0x0001000100010001
Mark Wielaard 1cb064
+volatile unsigned long long pcrelative_write_target[RELOC_BUFFER_SIZE];
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* Initialize the buffer to known values. */
Mark Wielaard 1cb064
+void init_pcrelative_write_target() {
Mark Wielaard 1cb064
+       int i;
Mark Wielaard 1cb064
+       for (i=0;i
Mark Wielaard 1cb064
+               pcrelative_write_target[i]=i*RELOC_BUFFER_PATTERN;
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* Review the pcrelative_write_target buffer; and print any
Mark Wielaard 1cb064
+   elements that vary from the initialized value.
Mark Wielaard 1cb064
+   Exclude portions of the output as appropriate if the current test
Mark Wielaard 1cb064
+   is marked for byte,halfword,word.  */
Mark Wielaard 1cb064
+void print_pcrelative_write_target() {
Mark Wielaard 1cb064
+  int i,z,rshift;
Mark Wielaard 1cb064
+  unsigned long long curr_value;
Mark Wielaard 1cb064
+  unsigned long long ref_value;
Mark Wielaard 1cb064
+  unsigned long long curr_token,init_token;
Mark Wielaard 1cb064
+  for (i=0;i
Mark Wielaard 1cb064
+    ref_value=i*RELOC_BUFFER_PATTERN;
Mark Wielaard 1cb064
+    curr_value = pcrelative_write_target[i];
Mark Wielaard 1cb064
+    if (ref_value != curr_value) {
Mark Wielaard 1cb064
+      printf(" ");
Mark Wielaard 1cb064
+      if (verbose)
Mark Wielaard 1cb064
+	printf("delta found: %d %llx -> %llx\n",i,ref_value,curr_value);
Mark Wielaard 1cb064
+      if (updates_byte) {
Mark Wielaard 1cb064
+	for (z=0;z<8;z++) {
Mark Wielaard 1cb064
+	  rshift=z*8;
Mark Wielaard 1cb064
+	  if (verbose) printf("z:%d ",z);
Mark Wielaard 1cb064
+	  init_token = (ref_value>>rshift) & 0xff;
Mark Wielaard 1cb064
+	  curr_token = (curr_value>>rshift) & 0xff;
Mark Wielaard 1cb064
+	  if (verbose)
Mark Wielaard 1cb064
+	    printf("wms byte:: %llx -> %llx \n",init_token,curr_token);
Mark Wielaard 1cb064
+	  if (init_token == curr_token && (updates_byte||updates_halfword||updates_word) ) {
Mark Wielaard 1cb064
+	     printf("%2s","  ");
Mark Wielaard 1cb064
+	  } else {
Mark Wielaard 1cb064
+	    printf("%02llx",curr_token);
Mark Wielaard 1cb064
+	  }
Mark Wielaard 1cb064
+        }
Mark Wielaard 1cb064
+      }
Mark Wielaard 1cb064
+      else if (updates_halfword) {
Mark Wielaard 1cb064
+	for (z=0;z<4;z++) {
Mark Wielaard 1cb064
+	  rshift=z*16;
Mark Wielaard 1cb064
+	  if (verbose) printf("z:%d ",z);
Mark Wielaard 1cb064
+	  init_token = (ref_value>>rshift) & 0xffff;
Mark Wielaard 1cb064
+	  curr_token = (curr_value>>rshift) & 0xffff;
Mark Wielaard 1cb064
+	  if (verbose)
Mark Wielaard 1cb064
+	    printf("wms half:: %llx -> %llx \n",init_token,curr_token);
Mark Wielaard 1cb064
+	  if (init_token == curr_token) {
Mark Wielaard 1cb064
+	     printf("%2s","  ");
Mark Wielaard 1cb064
+	  } else {
Mark Wielaard 1cb064
+	    printf("%04llx",curr_token);
Mark Wielaard 1cb064
+	  }
Mark Wielaard 1cb064
+        }
Mark Wielaard 1cb064
+      }
Mark Wielaard 1cb064
+      else if (updates_word) {
Mark Wielaard 1cb064
+	for (z=0;z<2;z++) {
Mark Wielaard 1cb064
+	  rshift=z*32;
Mark Wielaard 1cb064
+	  if (verbose) printf("z:%d ",z);
Mark Wielaard 1cb064
+	  init_token = (ref_value>>rshift) & 0xffffffff;
Mark Wielaard 1cb064
+	  curr_token = (curr_value>>rshift) & 0xffffffff;
Mark Wielaard 1cb064
+	  if (verbose)
Mark Wielaard 1cb064
+	    printf("wms word:: %llx -> %llx \n",init_token,curr_token);
Mark Wielaard 1cb064
+	  if (init_token == curr_token ) {
Mark Wielaard 1cb064
+	     printf("%2s","  ");
Mark Wielaard 1cb064
+	  } else {
Mark Wielaard 1cb064
+	    printf("%08llx",curr_token);
Mark Wielaard 1cb064
+	  }
Mark Wielaard 1cb064
+        }
Mark Wielaard 1cb064
+      }
Mark Wielaard 1cb064
+      else {
Mark Wielaard 1cb064
+	printf("%016llx ",curr_value);
Mark Wielaard 1cb064
+      }
Mark Wielaard 1cb064
+    }
Mark Wielaard 1cb064
+  }
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+/* Helper that returns the address of the pcrelative_write_target buffer.
Mark Wielaard 1cb064
+   Due to variances in where the sections land in memory, this value is
Mark Wielaard 1cb064
+   used to normalize the results.  (see paddi tests for usage).   */
Mark Wielaard 1cb064
+unsigned long long pcrelative_buff_addr(int x) {
Mark Wielaard 1cb064
+   /* Return the base address of the array.  The base address will be
Mark Wielaard 1cb064
+      a function of the code load address.  */
Mark Wielaard 1cb064
+   return (unsigned long long) &pcrelative_write_target[x];
Mark Wielaard 1cb064
+}
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
 void print_undefined () {
Mark Wielaard 1cb064
    if (debug_show_values)
Mark Wielaard 1cb064
       printf (" [Undef]");
Mark Wielaard 1cb064
@@ -1339,7 +1464,7 @@ void print_frt () {
Mark Wielaard 1cb064
       /* If the result is a dfp128 value, the dfp128 value is
Mark Wielaard 1cb064
          contained in the frt, frtp values which are split across
Mark Wielaard 1cb064
          a pair of VSRs.  */
Mark Wielaard 1cb064
-      if (uses_dfp128_output) {
Mark Wielaard 1cb064
+      if (!instruction_is_relative && uses_dfp128_output) {
Mark Wielaard 1cb064
 	 if (verbose) print_vsr (28);
Mark Wielaard 1cb064
 	 if (verbose) print_vsr (29);
Mark Wielaard 1cb064
 	 value1 = get_vsrhd_vs28 ();
Mark Wielaard 1cb064
@@ -1347,7 +1472,12 @@ void print_frt () {
Mark Wielaard 1cb064
 	 dissect_dfp128_float (value1, value3);
Mark Wielaard 1cb064
       } else {
Mark Wielaard 1cb064
 	 if (debug_show_raw_values) generic_print_float_as_hex (frt);
Mark Wielaard 1cb064
-	 printf (" %e", frt);
Mark Wielaard 1cb064
+	 if (instruction_is_relative) {
Mark Wielaard 1cb064
+	    printf ("_ %e _ ", frt);
Mark Wielaard 1cb064
+	    print_vsr (28);
Mark Wielaard 1cb064
+	 } else {
Mark Wielaard 1cb064
+		printf (" %e", frt);
Mark Wielaard 1cb064
+	  }
Mark Wielaard 1cb064
 	 if (has_frtp) {
Mark Wielaard 1cb064
 	    if (debug_show_raw_values) generic_print_float_as_hex (frtp);
Mark Wielaard 1cb064
 	    printf (" %e", frtp);
Mark Wielaard 1cb064
@@ -1652,7 +1782,15 @@ void print_all() {
Mark Wielaard 1cb064
 void print_register_header () {
Mark Wielaard 1cb064
   post_test = 0;
Mark Wielaard 1cb064
   if (debug_show_all_regs) print_all();
Mark Wielaard 1cb064
-  if (has_ra) print_ra ();
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+  if (has_ra) {
Mark Wielaard 1cb064
+	  /* Suppress the print of RA if the instruction has
Mark Wielaard 1cb064
+	     R==1, since the ra value must be zero for the
Mark Wielaard 1cb064
+	     instruction to be valid.  */
Mark Wielaard 1cb064
+	  if (!instruction_is_relative)
Mark Wielaard 1cb064
+		 print_ra();
Mark Wielaard 1cb064
+  }
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
   if (has_rb) print_rb ();
Mark Wielaard 1cb064
   if (has_rc) print_rc ();
Mark Wielaard 1cb064
   if (has_rs) print_rs();
Mark Wielaard 1cb064
@@ -1894,6 +2032,11 @@ void set_up_iterators () {
Mark Wielaard 1cb064
    } else {
Mark Wielaard 1cb064
 	   a_start=0; b_start=0; c_start=0; m_start=0;
Mark Wielaard 1cb064
    }
Mark Wielaard 1cb064
+   /* Special casing for R==1 tests. */
Mark Wielaard 1cb064
+   if (instruction_is_relative) {
Mark Wielaard 1cb064
+	  a_iters = 1;
Mark Wielaard 1cb064
+	  m_start=3; m_iters=4;
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
    if ((has_vra+has_vrb+has_vrc+has_vrm+has_xa+has_xb+uses_MC > 2) &&
Mark Wielaard 1cb064
        (!debug_enable_all_iters)) {
Mark Wielaard 1cb064
       /* Instruction tests using multiple fields will generate a lot of
Mark Wielaard 1cb064
@@ -2196,15 +2339,12 @@ void initialize_source_registers () {
Mark Wielaard 1cb064
 	  vrb[0] = vsxargs[ (vrbi  ) % isr_modulo];
Mark Wielaard 1cb064
 	  vrb[1] = vsxargs[ (vrbi+1) % isr_modulo];
Mark Wielaard 1cb064
    }
Mark Wielaard 1cb064
- 
Mark Wielaard 1cb064
-  if (has_xa) { 
Mark Wielaard 1cb064
-    vec_xa[0] = vsxargs[ (vrai  ) % isr_modulo];
Mark Wielaard 1cb064
-    vec_xa[1] = vsxargs[ (vrai+1) % isr_modulo];
Mark Wielaard 1cb064
-  }
Mark Wielaard 1cb064
-  if (has_xb) {
Mark Wielaard 1cb064
-    vec_xb[0] = vsxargs[ (vrbi  ) % isr_modulo];
Mark Wielaard 1cb064
-    vec_xb[1] = vsxargs[ (vrbi+1) % isr_modulo];
Mark Wielaard 1cb064
-  }
Mark Wielaard 1cb064
+
Mark Wielaard 1cb064
+   if (instruction_is_relative) {
Mark Wielaard 1cb064
+     /* for pstxsd and friends using R=1 */
Mark Wielaard 1cb064
+     vec_xa[0] = vsxargs[ (vrai+2  ) % isr_modulo];
Mark Wielaard 1cb064
+     vec_xa[1] = vsxargs[ (vrai+3  ) % isr_modulo];
Mark Wielaard 1cb064
+   }
Mark Wielaard 1cb064
 
Mark Wielaard 1cb064
    // xap 'shares' with the second half of an xa-pair.
Mark Wielaard 1cb064
   if (has_xap ) {