From: Dirk Mueller Date: Thu, 1 Dec 2005 10:02:35 +0000 (+0000) Subject: merge from trunk: X-Git-Tag: svn/VALGRIND_3_1_1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a89423396ce498624d82d6cc79861e7b1734d262;p=thirdparty%2Fvalgrind.git merge from trunk: r5247 | cerion | 2005-11-29 12:08:33 +0100 (Tue, 29 Nov 2005) | 4 lines Stop gcc4 complaints re ppc32 test - Moved all declarations in front of statements. Based on patch from Yao Qi . git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_1_BRANCH@5258 --- diff --git a/none/tests/ppc32/jm-insns.c b/none/tests/ppc32/jm-insns.c index 1bfe838c47..d070716c95 100644 --- a/none/tests/ppc32/jm-insns.c +++ b/none/tests/ppc32/jm-insns.c @@ -3894,21 +3894,21 @@ static void build_ii16_table (void) #if defined (HAS_ALTIVEC) static void build_viargs_table (void) { - unsigned int i=0; - #if !defined (ALTIVEC_ARGS_LARGE) - i=2; + unsigned int i=2; viargs = memalign(16, i * sizeof(vector unsigned int)); viargs[0] = (vector unsigned int) { 0x01020304,0x05060708,0x090A0B0C,0x0E0D0E0F }; viargs[1] = (vector unsigned int) { 0xF1F2F3F4,0xF5F6F7F8,0xF9FAFBFC,0xFEFDFEFF }; #else + unsigned int i,j; // build from iargs table (large/default already set) viargs = malloc(nb_iargs * sizeof(vector unsigned int)); for (i=0; i %08x (%08x %08x, %08x, %08x)\n", - name, 9, iargs[k], res, flags, xer, lr, ctr); + name, j, iargs[k], res, flags, xer, lr, ctr); } #endif } @@ -5627,18 +5629,23 @@ static void test_av_int_one_arg (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in, vec_out, vscr; + unsigned int *src, *dst; int i; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -5680,20 +5687,25 @@ static void test_av_int_two_args (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in1, vec_in2, vec_out, vscr; + unsigned int *src1, *src2, *dst; int i,j; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -5740,22 +5752,27 @@ static void test_av_int_three_args (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in1, vec_in2, vec_in3, vec_out, vscr; + unsigned int *src1, *src2, *src3, *dst; int i,j,k; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x%08x%08x%08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -5808,21 +5825,27 @@ static void vs128_cb (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned char vec_shft; + volatile vector unsigned int vec_in1, vec_out, vscr; + unsigned int *src1, *src2, *dst; int i,j; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 - printf("(%08x, %08x)\n", flags, p_vscr[3]); + p_vscr = (unsigned int*)𝓋 + printf("(%08x, %08x)\n", flags, p_vscr[3]); #else - printf("(%08x)\n", flags); + printf("(%08x)\n", flags); #endif } if (verbose) printf("\n"); @@ -5870,14 +5893,19 @@ static void vsplt_cb (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in1, vec_out, vscr; uint32_t func_buf[2], *p; + unsigned int *src1, *dst; int i,j; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 - printf("(%08x, %08x)\n", flags, p_vscr[3]); + p_vscr = (unsigned int*)𝓋 + printf("(%08x, %08x)\n", flags, p_vscr[3]); #else - printf("(%08x)\n", flags); + printf("(%08x)\n", flags); #endif } if (verbose) printf("\n"); @@ -5935,11 +5963,16 @@ static void vspltis_cb (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_out, vscr; uint32_t func_buf[2], *p; + unsigned int *dst; int i; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i<32; i++) { - vector unsigned int vec_out = (vector unsigned int){ 0,0,0,0 }; + vec_out = (vector unsigned int){ 0,0,0,0 }; /* Patch up the instruction */ p = (void *)func; @@ -5952,7 +5985,7 @@ static void vspltis_cb (const char* name, test_func_t func, __asm__ __volatile__ ("mfvscr %0" : "=vr" (tmpvscr)); // reset VSCR and CR - vector unsigned int vscr = (vector unsigned int){ 0,0,0,DEFAULT_VSCR }; + vscr = (vector unsigned int){ 0,0,0,DEFAULT_VSCR }; flags = 0; __asm__ __volatile__ ("mtvscr %0" : : "vr" (vscr) ); __asm__ __volatile__ ("mtcr %0" : : "r" (flags)); @@ -5971,12 +6004,12 @@ static void vspltis_cb (const char* name, test_func_t func, __asm__ __volatile__ ("mtcr %0" : : "r" (tmpcr)); __asm__ __volatile__ ("mtvscr %0" : : "vr" (tmpvscr)); - unsigned int* dst = (unsigned int*)&vec_out; + dst = (unsigned int*)&vec_out; printf("%s: %2d => ", name, i); printf("%08x %08x %08x %08x ", dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -5989,15 +6022,20 @@ static void vsldoi_cb (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in1, vec_in2, vec_out, vscr; uint32_t func_buf[2], *p; + unsigned int *src1, *src2, *dst; int i,j,k; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x] ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -6061,10 +6099,15 @@ static void lvs_cb (const char *name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_out, vscr; + unsigned int *dst; int i; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=-1; i<17; i++) { - vector unsigned int vec_out = (vector unsigned int){ 0,0,0,0 }; + vec_out = (vector unsigned int){ 0,0,0,0 }; // make sure start address is 16 aligned - use viargs[0] r15 = (uint32_t)&viargs[0]; @@ -6075,7 +6118,7 @@ static void lvs_cb (const char *name, test_func_t func, __asm__ __volatile__ ("mfvscr %0" : "=vr" (tmpvscr)); // reset VSCR and CR - vector unsigned int vscr = (vector unsigned int){ 0,0,0,DEFAULT_VSCR }; + vscr = (vector unsigned int){ 0,0,0,DEFAULT_VSCR }; flags = 0; __asm__ __volatile__ ("mtvscr %0" : : "vr" (vscr) ); __asm__ __volatile__ ("mtcr %0" : : "r" (flags)); @@ -6094,7 +6137,7 @@ static void lvs_cb (const char *name, test_func_t func, __asm__ __volatile__ ("mtcr %0" : : "r" (tmpcr)); __asm__ __volatile__ ("mtvscr %0" : : "vr" (tmpvscr)); - unsigned int* dst = (unsigned int*)&vec_out; + dst = (unsigned int*)&vec_out; printf("%s %3d, %3d", name, i, 0); printf(" => %08x %08x %08x %08x ", dst[0], dst[1], dst[2], dst[3]); printf("(%08x)\n", flags); @@ -6165,6 +6208,8 @@ static void test_av_int_ld_two_regs (const char *name, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in, vec_out, vscr; + unsigned int *src, *dst; int i,j, k, do_mask; do_mask = 0; @@ -6174,7 +6219,7 @@ static void test_av_int_ld_two_regs (const char *name, for (i=0; i>1)) p[k] = (short)0; - } + } if (do_mask == 4) { int* p = (int*)dst; for (k = 0; k < 4; k++) if (k != (j>>2)) p[k] = (int)0; - } + } printf("%s %3d, %08x %08x %08x %08x", name, j, src[0], src[1], src[2], src[3]); printf(" => %08x %08x %08x %08x ", dst[0], dst[1], dst[2], dst[3]); @@ -6247,6 +6292,8 @@ static void test_av_int_st_three_regs (const char *name, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in, vec_out, vscr; + unsigned int *src, *dst; int i,j; vector unsigned int* viargs_priv; @@ -6258,7 +6305,7 @@ static void test_av_int_st_three_regs (const char *name, for (i=0; i %08x %08x %08x %08x ", dst[0], dst[1], dst[2], dst[3]); printf("(%08x)\n", flags); @@ -6324,7 +6371,13 @@ static void test_av_float_one_arg (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector float vec_in, vec_out; + volatile vector unsigned int vscr; + unsigned int *src, *dst; int i; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif /* if we're doing an estimation operation, arrange to zap the bottom byte of the result as it's basically garbage, and differs @@ -6334,15 +6387,15 @@ static void test_av_float_one_arg (const char* name, test_func_t func, ? 0xFFFFFF00 : 0xFFFFFFFF; for (i=0; i %08x %08x %08x %08x ", name, dst[0] & mask, dst[1] & mask, dst[2] & mask, dst[3] & mask); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -6385,20 +6438,26 @@ static void test_av_float_two_args (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector float vec_in1, vec_in2, vec_out; + volatile vector unsigned int vscr; + unsigned int *src1, *src2, *dst; int i,j; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -6446,22 +6505,28 @@ static void test_av_float_three_args (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector float vec_in1, vec_in2, vec_in3, vec_out; + volatile vector unsigned int vscr; + unsigned int *src1, *src2, *src3, *dst; int i,j,k; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i %08x %08x %08x %08x ", name, dst[0], dst[1], dst[2], dst[3]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -6513,14 +6578,19 @@ static void vcvt_cb (const char* name, test_func_t func, { volatile uint32_t flags, tmpcr; volatile vector unsigned int tmpvscr; + volatile vector unsigned int vec_in, vec_out, vscr; uint32_t func_buf[2], *p; + unsigned int *src, *dst; int i,j; +#if defined TEST_VSCR_SAT + unsigned int* p_vscr; +#endif for (i=0; i r14 - __asm__ __volatile__ ("vor 14,%0,%0" : : "vr" (vec_in1)); + __asm__ __volatile__ ("vor 14,%0,%0" : : "vr" (vec_in)); // do stuff (*func)(); @@ -6555,13 +6625,13 @@ static void vcvt_cb (const char* name, test_func_t func, __asm__ __volatile__ ("mtcr %0" : : "r" (tmpcr)); __asm__ __volatile__ ("mtvscr %0" : : "vr" (tmpvscr)); - unsigned int* src1 = (unsigned int*)&vec_in1; - unsigned int* dst = (unsigned int*)&vec_out; - printf("%s: %08x (%13e), %2u", name, src1[0], *(float*)(&src1[0]), j); + src = (unsigned int*)&vec_in; + dst = (unsigned int*)&vec_out; + printf("%s: %08x (%13e), %2u", name, src[0], *(float*)(&src[0]), j); printf(" => %08x (%13e) ", dst[0], *(float*)(&dst[0])); // printf(" => %08x ", dst[0]); #if defined TEST_VSCR_SAT - unsigned int* p_vscr = (unsigned int*)𝓋 + p_vscr = (unsigned int*)𝓋 printf("(%08x, %08x)\n", flags, p_vscr[3]); #else printf("(%08x)\n", flags); @@ -6831,7 +6901,7 @@ static void usage (void) { #if !defined (USAGE_SIMPLE) fprintf(stderr, - "test-ppc [-1] [-2] [-3] [-*] [-t ] [-f ] [-u] " + "jm-insns [-1] [-2] [-3] [-*] [-t ] [-f ] [-u] " "[-n ] [-r ] [-h]\n" "\t-1: test opcodes with one argument\n" "\t-2: test opcodes with two arguments\n" @@ -6863,7 +6933,7 @@ static void usage (void) ); #else fprintf(stderr, - "test-ppc [-a]\n" + "jm-insns [-a]\n" "\t-a: include tests for altivec instructions\n" ); #endif @@ -6998,8 +7068,8 @@ int main (int argc, char **argv) #else /* Simple usage: - ./test-ppc => all insns, except AV - ./test-ppc -a => all insns, including AV + ./jm-insns => all insns, except AV + ./jm-insns -a => all insns, including AV */ char *filter = NULL; insn_sel_flags_t flags;