Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / none / tests / ppc64 / isa_3_1_helpers.h
blobb559e730e7d6df2082dcbb82cec95900c07ac15c
1 /* isa_3_1_helpers.h */
3 #include "isa_3_1_register_defines.h"
5 extern unsigned long a_iters,b_iters,c_iters, m_iters;
6 extern unsigned long vrai,vrbi,vrci,vrmi;
7 extern unsigned long a_inc, b_inc, c_inc, m_inc;
8 extern unsigned long a_start, b_start, c_start, m_start;
9 extern unsigned long a_limit,b_limit,c_limit;
10 extern vector unsigned long long vrt, vra, vrb, vrc;
11 extern vector unsigned long long vrm;
12 extern vector unsigned long long vec_xs;
13 extern vector unsigned long long vec_xt;
14 extern unsigned long long dcmx;
16 extern unsigned long current_cr;
17 extern unsigned long current_fpscr;
19 typedef void (*test_func_t) (void);
20 struct test_list_t {
21 test_func_t func;
22 const char *name;
23 const char *form;
24 unsigned long mask; /* holds SP or DP indicators. */
26 typedef struct test_list_t test_list_t;
27 extern struct test_list_t current_test;
28 typedef void (*test_group_t) (const char *name, test_func_t func,
29 unsigned int unused, char * cur_form);
31 /* Misc options for debug. */
32 /* setup_only indicates to do all of the register initializations,
33 but skip the instruction test. */
34 extern unsigned long setup_only;
35 extern int verbose;
36 extern unsigned long prefix_override;
37 extern unsigned long vrm_override;
38 extern unsigned long mc_override;
39 extern unsigned long enable_setjmp;
40 extern unsigned long dump_tables;
41 extern void debug_show_form(const char *, char *);
42 extern void debug_show_current_iteration();
43 extern void debug_dump_buffer();
45 extern void identify_form_components(const char *, const char *);
46 extern void identify_instruction_by_func_name(const char *);
47 extern void init_pcrelative_write_target();
48 extern void print_pcrelative_write_target();
49 extern void dump_vsxargs();
50 extern void generic_prologue();
51 extern void build_args_table();
52 extern void build_vsx_table();
53 extern void print_register_header();
54 extern void print_register_footer();
55 extern void debug_show_iter_ranges();
56 extern void print_result_buffer();
57 extern void dump_float_vsx_tables();
58 extern void build_float_vsx_tables();
59 extern void initialize_target_registers();
60 extern void initialize_source_registers();
61 extern void set_up_iterators();
62 extern void initialize_buffer(int);
64 /* This (TEXT_BSS_DELTA) is the relative distance between those
65 sections as set by the linker options for the R==1 tests. */
66 #define TEXT_BSS_DELTA 0x20000
67 #define RELOC_BUFFER_SIZE 0x1000
68 extern unsigned long long pcrelative_buff_addr(int);
69 #define PAD_ORI \
70 __asm__ __volatile__ ("ori 21,21,21" \
71 : /* empty: no outputs from asm to C */ \
72 : /* empty: no inputs from C to asm */ \
73 : "21" /* clobbers register 21 */); \
74 __asm__ __volatile__ ("ori 22,22,22" \
75 : /* empty: no outputs from asm to C */ \
76 : /* empty: no inputs from C to asm */ \
77 : "22" /* clobbers register 22 */); \
78 __asm__ __volatile__ ("ori 23,23,23" \
79 : /* empty: no outputs from asm to C */ \
80 : /* empty: no inputs from C to asm */ \
81 : "23" /* clobbers register 23 */); \
82 __asm__ __volatile__ ("ori 24,24,24" \
83 : /* empty: no outputs from asm to C */ \
84 : /* empty: no inputs from C to asm */ \
85 : "24" /* clobbers register 24 */); \
86 __asm__ __volatile__ ("ori 25,25,25" \
87 : /* empty: no outputs from asm to C */ \
88 : /* empty: no inputs from C to asm */ \
89 : "25" /* clobbers register 25 */); \
90 __asm__ __volatile__ ("ori 26,26,26" \
91 : /* empty: no outputs from asm to C */ \
92 : /* empty: no inputs from C to asm */ \
93 : "26" /* clobbers register 26 */); \
94 __asm__ __volatile__ ("ori 27,27,27" \
95 : /* empty: no outputs from asm to C */ \
96 : /* empty: no inputs from C to asm */ \
97 : "27" /* clobbers register 27 */); \
98 __asm__ __volatile__ ("ori 28,28,28" \
99 : /* empty: no outputs from asm to C */ \
100 : /* empty: no inputs from C to asm */ \
101 : "28" /* clobbers register 28 */);
103 extern int verbose;
104 #define debug_printf(X) if (verbose>0) printf(X);
105 #define debug_show_labels (verbose>0)
106 #define debug_show_iters (verbose>1)
107 #define debug_show_values (verbose>2)
108 #define debug_show_all_regs (verbose>5)
109 #define debug_show_tables (verbose>6)
110 #define debug_show_raw_values (verbose>7)
111 #define debug_enable_all_iters (verbose>8)
114 #define CHECK_OVERRIDES { \
115 if (vrm_override && vrmi > 0) continue; \
116 if (prefix_override && strncmp("p", instruction_name, 1) == 0) { \
117 if (verbose) printf("Skipping prefix insn test %s\n",instruction_name); \
118 continue; \
122 /* CR helpers. */
124 #define ALLCR "cr0","cr1","cr2","cr3","cr4","cr5","cr6","cr7"
126 #define SET_CR(_arg) \
127 __asm__ __volatile__ ("mtcr %0" : : "b"(_arg) : ALLCR );
129 #define SET_CR0_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x80,%0 " : : "b" (_arg):"cr0");
130 #define SET_CR1_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x40,%0 " : : "b" (_arg):"cr1");
131 #define SET_CR2_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x20,%0 " : : "b" (_arg):"cr2");
132 #define SET_CR3_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x10,%0 " : : "b" (_arg):"cr3");
133 #define SET_CR4_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x08,%0 " : : "r" (_arg):"cr4");
134 #define SET_CR5_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x04,%0 " : : "r" (_arg):"cr5");
135 #define SET_CR6_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x02,%0 " : : "r" (_arg):"cr6");
136 #define SET_CR7_FIELD(_arg) __asm__ __volatile__ ("mtocrf 0x01,%0 " : : "r" (_arg):"cr7");
138 #define SET_XER(_arg) __asm__ __volatile__ ("mtxer %0" : : "b"(_arg) : "xer" );
139 #define GET_CR(_lval) __asm__ __volatile__ ("mfcr %0" : "=b"(_lval) )
140 #define GET_XER(_lval) __asm__ __volatile__ ("mfxer %0" : "=b"(_lval) )
141 #define SET_CR_ZERO SET_CR(0)
143 /* ************** */
144 /* FPSCR helpers. */
145 #define SET_FPSCR_ZERO \
146 do { \
147 double _d = 0.0; \
148 __asm__ __volatile__ ("mtfsf 0xFF, %0" : : "f"(_d) ); \
149 } while (0);
151 #define GET_FPSCR(_arg) \
152 __asm__ __volatile__ ("mffs %0" : "=f"(_arg) );