]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
fix compiler print format warnings in test_isa_3_0.c
authorCarl Love <cel@us.ibm.com>
Tue, 28 Sep 2021 20:58:22 +0000 (20:58 +0000)
committerCarl Love <cel@us.ibm.com>
Thu, 30 Sep 2021 23:12:33 +0000 (18:12 -0500)
GCC fixed the compiler warnings long long types.  Add explicit
casts so gcc will not generate compile warnings.

NEWS
none/tests/ppc64/test_isa_3_0.c

diff --git a/NEWS b/NEWS
index ef36395dea8cfd0cba5fc7e653b261ed0a9fc156..8f6251840114911e08e1842c3e8b5195b7bf5c32 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 443178  Powerpc, test jm-mfspr expected output needs to be updated.
 443179  Need new test for the lxvx and stxvx instructions on ISA 2.07 and
         ISA 3.0 systems.
+443180  The subnormal test and the ISA 3.0 test generate compiler warnings.
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
index cf9df8ac9c03e949c8186d3015cc60638b643576..6eca370a39cc14edc233dd631c4a52be42274a8d 100644 (file)
@@ -2633,8 +2633,8 @@ static void testfunction_vector_absolute (const char* instruction_name,
 
          printf("%s xa:%016lx %016lx xb:%016lx %016lx ",
                 instruction_name,
-                vec_xa[1],vec_xa[0],
-                vec_xb[1],vec_xb[0]
+                (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                (unsigned long)vec_xb[1], (unsigned long)vec_xb[0]
                 );
          printf(" => ");
 
@@ -2644,7 +2644,8 @@ static void testfunction_vector_absolute (const char* instruction_name,
 
          GET_CR(cr);
 
-         printf(" xt:%016lx %016lx (%08x)\n", vec_xt[1], vec_xt[0], cr);
+         printf(" xt:%016lx %016lx (%08x)\n", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0], cr);
       }
       if (verbose) printf("\n");
    }
@@ -2673,9 +2674,9 @@ static void testfunction_vector_xxpermute (const char* instruction_name,
 
          printf("%s %016lx %016lx %016lx %016lx, pcv[%016lx %016lx] => ",
                 instruction_name,
-                vec_xa[1], vec_xa[0],
-                vec_xt[1], vec_xt[0],
-                vec_xb[1], vec_xb[0]);
+                (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                (unsigned long)vec_xt[1], (unsigned long)vec_xt[0],
+                (unsigned long)vec_xb[1], (unsigned long)vec_xb[0]);
 
          SET_CR_ZERO;
 
@@ -2683,14 +2684,15 @@ static void testfunction_vector_xxpermute (const char* instruction_name,
 
          GET_CR(cr);
 
-         printf(" %016lx %016lx (%08x)\n", vec_xt[1], vec_xt[0], cr);
+         printf(" %016lx %016lx (%08x)\n", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0], cr);
 
 #if defined (DEBUG_VECTOR_PERMUTE)
          printf("DEBUG:%s %016lx %016lx %016lx %016lx, pcv[%016lx %016lx]\n",
                 ignore_name,
-                vec_xa[1], vec_xa[0],
-                vec_xt[1], vec_xt[0],
-                vec_xb[1], vec_xb[0]);
+                (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                (unsigned long)vec_xt[1], (unsigned long)vec_xt[0],
+                (unsigned long)vec_xb[1], (unsigned long)vec_xb[0]);
 #endif
       }
       if (verbose) printf("\n");
@@ -2719,13 +2721,13 @@ static void testfunction_vector_logical_one (const char* instruction_name,
 
          printf("%s xa:%016lx %016lx xt:%016lx %016lx => ",
                 instruction_name,
-                vec_xa[1], vec_xa[0],
-                vec_xt[1], vec_xt[0]);
+                (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                (unsigned long)vec_xt[1], (unsigned long)vec_xt[0]);
 
          (*test_function)();
 
          printf(" xt:%016lx %016lx\n",
-                vec_xt[1], vec_xt[0]);
+                (unsigned long)vec_xt[1], (unsigned long)vec_xt[0]);
       }
    }
    if (verbose) printf("\n");
@@ -2752,7 +2754,7 @@ static void testfunction_gpr_vector_logical_one (const char* instruction_name,
 
       printf("%s rt xt:%016lx %016lx => ",
             instruction_name,
-            vec_xa[1], vec_xa[0]);
+            (unsigned long)vec_xa[1], (unsigned long)vec_xa[0]);
 
       (*test_function)();
 
@@ -2786,9 +2788,9 @@ static void testfunction_vector_logical_four (const char* instruction_name,
 
             printf("%s %016lx %016lx %016lx %016lx, pcv[%016lx %016lx] => ",
                    instruction_name,
-                   vec_xa[1], vec_xa[0],
-                   vec_xb[1], vec_xb[0],
-                   vec_xc[1], vec_xc[0]);
+                   (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                   (unsigned long)vec_xb[1], (unsigned long)vec_xb[0],
+                   (unsigned long)vec_xc[1], (unsigned long)vec_xc[0]);
 
             SET_CR_ZERO;
 
@@ -2796,7 +2798,8 @@ static void testfunction_vector_logical_four (const char* instruction_name,
 
             GET_CR(cr);
 
-            printf(" %016lx %016lx (%08x)\n", vec_xt[1], vec_xt[0], cr);
+            printf(" %016lx %016lx (%08x)\n", (unsigned long)vec_xt[1],
+                   (unsigned long)vec_xt[0], cr);
          }
       }
 
@@ -2827,8 +2830,8 @@ void testfunction_vector_insert_or_extract_immediate (const char* instruction_na
        * suppress output for those cases per the global variable.
        */
       for (x_index = 0; x_index < 16 ; x_index++) {
-         vec_xb[0] = (unsigned long) vsxargs[i];
-         vec_xb[1] = (unsigned long) vsxargs[i+1];
+         vec_xb[0] = (unsigned long)vsxargs[i];
+         vec_xb[1] = (unsigned long)vsxargs[i+1];
 
          /* Run each test against all zeros and then all ones,
           * This is intended to help any bitfield changes stand out.
@@ -2844,10 +2847,12 @@ void testfunction_vector_insert_or_extract_immediate (const char* instruction_na
 
             if (!insert_extract_error) {
                printf("%s %016lx %016lx [%d] (into%s) => ",
-                      instruction_name, vec_xb[1], vec_xb[0], x_index,
+                      instruction_name, (unsigned long)vec_xb[1],
+                      (unsigned long)vec_xb[0], x_index,
                       (t == 0 ? " zeros" : "  ones") );
 
-               printf("%016lx %016lx\n", vec_xt[1], vec_xt[0]);
+               printf("%016lx %016lx\n", (unsigned long)vec_xt[1],
+                      (unsigned long)vec_xt[0]);
             }
          }
       }
@@ -2871,11 +2876,13 @@ static void testfunction_vector_immediate (const char * instruction_name,
          vec_xt[1] = (t == 0) ? 0 : 0xffffffffffffffff;
 
          printf("%s %016lx %016lx [%2x] => ",
-                instruction_name, vec_xt[1], vec_xt[0], x_splat);
+                instruction_name, (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0], x_splat);
 
          (*test_function)();
 
-         printf("%016lx %016lx\n", vec_xt[1], vec_xt[0]);
+         printf("%016lx %016lx\n", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0]);
       }
    }
 }
@@ -2906,13 +2913,15 @@ static void testfunction_vector_loadstore (const char* instruction_name,
          initialize_buffer(buffer_pattern);
 
          printf("%s ", instruction_name);
-         printf("%016lx %016lx ", vec_xt[1], vec_xt[0]);
+         printf("%016lx %016lx ", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0]);
          dump_small_buffer();
          printf(" =>\n");
 
          (*test_function)();
 
-         printf("    %016lx %016lx ", vec_xt[1], vec_xt[0]);
+         printf("    %016lx %016lx ", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0]);
          dump_small_buffer();
          printf("\n");
       }
@@ -2943,12 +2952,14 @@ static void testfunction_vectorscalar_move_tofrom (const char * instruction_name
          vec_xt[1] = pattern[v%PATTERN_SIZE];
 
          printf("%s ", instruction_name);
-         printf("%016lx %016lx %lx %016lx ", vec_xt[1], vec_xt[0],
+         printf("%016lx %016lx %lx %016lx ", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0],
                 (long unsigned)r14,  (long unsigned)r15 );
 
          (*test_function)();
 
-         printf("=> %016lx %016lx %lx %016lx", vec_xt[1], vec_xt[0],
+         printf("=> %016lx %016lx %lx %016lx", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0],
                 (long unsigned)r14,  (long unsigned)r15 );
          printf("\n");
       }
@@ -2998,7 +3009,8 @@ static void testfunction_vector_scalar_loadstore_length (const char* instruction
             initialize_buffer(buffer_pattern);
 
             printf("%s ", instruction_name);
-            printf("%016lx %016lx ", vec_xt[1], vec_xt[0] );
+            printf("%016lx %016lx ", (unsigned long)vec_xt[1],
+                   (unsigned long)vec_xt[0] );
             if (uses_bits_0to7(instruction_name)) {
                printf(" 0x%2lx ", (long unsigned)r15>>56 );
 
@@ -3029,8 +3041,8 @@ static void testfunction_vector_scalar_loadstore_length (const char* instruction
              vec_xt[1] &= 0xFFFFFFFF00000000;
            }
 
-            printf("=> %016lx %016lx & %16lx", vec_xt[1], vec_xt[0],
-                   (long unsigned)r15 );
+            printf("=> %016lx %016lx & %16lx", (unsigned long)vec_xt[1],
+                   (unsigned long)vec_xt[0], (long unsigned)r15 );
             dump_small_buffer();
 
             printf("\n");
@@ -3052,7 +3064,8 @@ static void testfunction_vector_count_bytes (const char* instruction_name,
       r14 = 0;
 
       printf("%s ", instruction_name);
-      printf("%016lx %016lx %2d ", vec_xb[1], vec_xb[0], (unsigned)r14);
+      printf("%016lx %016lx %2d ", (unsigned long)vec_xb[1],
+             (unsigned long)vec_xb[0], (unsigned)r14);
 
       (*test_function)();
 
@@ -3074,7 +3087,8 @@ static void testfunction_vector_extract (const char* instruction_name,
       r14 = 0;
 
       printf("%s ", instruction_name);
-      printf("%016lx %016lx %2d ", vec_xb[1], vec_xb[0], (unsigned)r15);
+      printf("%016lx %016lx %2d ", (unsigned long)vec_xb[1],
+             (unsigned long)vec_xb[0], (unsigned)r15);
 
       (*test_function)();
 
@@ -3096,11 +3110,13 @@ static void testfunction_vector_extend_sign (const char* instruction_name,
       vec_xt = (vector unsigned long){0, 0};
 
       printf("%s ", instruction_name);
-      printf("%016lx %016lx ", vec_xb[1], vec_xb[0]);
+      printf("%016lx %016lx ",(unsigned long) vec_xb[1],
+             (unsigned long)vec_xb[0]);
 
       (*test_function)();
 
-      printf("=> %016lx %016lx\n", vec_xt[1], vec_xt[0]);
+      printf("=> %016lx %016lx\n", (unsigned long)vec_xt[1],
+             (unsigned long)vec_xt[0]);
    }
 }
 
@@ -3210,7 +3226,8 @@ static inline void testfunction_bcd_setup_inputs(const char * instruction_name,
 
 static inline void testfunction_bcd_display_outputs(const char * instruction_name) {
 
-   printf(" xt:%016lx %016lx", vec_xt[1], vec_xt[0] );
+   printf(" xt:%016lx %016lx", (unsigned long)vec_xt[1],
+          (unsigned long)vec_xt[0] );
 
    if (convert_to_zoned(instruction_name)) {
       /* convert to zoned */
@@ -3276,7 +3293,8 @@ static void testfunction_vector_scalar_two_quad (const char* instruction_name,
       vec_xt = (vector unsigned long){0, 0};
 
       printf("%s ", instruction_name);
-      printf("%016lx %016lx ", vec_xb[1], vec_xb[0]);
+      printf("%016lx %016lx ", (unsigned long)vec_xb[1],
+             (unsigned long)vec_xb[0]);
 
       SET_FPSCR_ZERO
 
@@ -3284,7 +3302,8 @@ static void testfunction_vector_scalar_two_quad (const char* instruction_name,
 
       GET_FPSCR(local_fpscr);
 
-      printf("=> %016lx %016lx", vec_xt[1], vec_xt[0]);
+      printf("=> %016lx %016lx", (unsigned long)vec_xt[1],
+             (unsigned long)vec_xt[0]);
       dissect_fpscr(local_fpscr);
       printf("\n");
    }
@@ -3330,12 +3349,13 @@ testfunction_vector_scalar_compare_double (const char* instruction_name,
             SET_FPSCR_ZERO
             if (instruction_only_uses_dword0_inputs(instruction_name)) {
                printf("%s %016lx %016lx",
-                      instruction_name, vec_xa[1], vec_xb[1]);
+                      instruction_name, (unsigned long)vec_xa[1],
+                      (unsigned long)vec_xb[1]);
             } else {
                printf("%s %016lx %016lx %016lx %016lx",
                       instruction_name,
-                      vec_xa[1], vec_xa[0],
-                      vec_xb[1], vec_xb[0]);
+                      (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                      (unsigned long)vec_xb[1], (unsigned long)vec_xb[0]);
             }
 
             if (verbose) printf(" cr#%d ", x_index);
@@ -3345,7 +3365,8 @@ testfunction_vector_scalar_compare_double (const char* instruction_name,
             (*test_function)();
 
             if (instruction_only_uses_dword0_inputs(instruction_name)) {
-               printf("%016lx %016lx", vec_xt[1], vec_xt[0]);
+               printf("%016lx %016lx", (unsigned long)vec_xt[1],
+                      (unsigned long)vec_xt[0]);
             }
 
             dissect_fpscr(local_fpscr);
@@ -3397,14 +3418,16 @@ testfunction_vector_scalar_data_class (const char* instruction_name,
 
          if (dcmx_match || (verbose>2)) {
             printf("%s %016lx, %016lx ",
-                   instruction_name, vec_xb[1], vec_xb[0]);
+                   instruction_name, (unsigned long)vec_xb[1],
+                   (unsigned long)vec_xb[0]);
 
             print_dcmx_field(x_index);
 
             if (dcmx_match)
                printf(" => Match.  ");
 
-            printf(" %016lx, %016lx ", vec_xt[1], vec_xt[0]);
+            printf(" %016lx, %016lx ", (unsigned long)vec_xt[1],
+                   (unsigned long)vec_xt[0]);
 
             dissect_cr_rn(local_cr,3);
             dissect_fpscr_dcmx_indicator(local_fpscr);
@@ -3412,9 +3435,11 @@ testfunction_vector_scalar_data_class (const char* instruction_name,
          }
 
          printf("%s %016lx, %016lx => ",
-                instruction_name, vec_xb[1], vec_xb[0]);
+                instruction_name, (unsigned long)vec_xb[1],
+                (unsigned long)vec_xb[0]);
 
-         printf(" %016lx, %016lx\n", vec_xt[1], vec_xt[0]);
+         printf(" %016lx, %016lx\n", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0]);
       }
    }
 }
@@ -3444,8 +3469,8 @@ static void testfunction_vector_scalar_compare_quads (const char* instruction_na
              */
             printf("%s %016lx%016lx %016lx%016lx (cr#%d) => ",
                    instruction_name,
-                   vec_xa[1], vec_xa[0],
-                   vec_xb[1], vec_xb[0],
+                   (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                   (unsigned long)vec_xb[1], (unsigned long)vec_xb[0],
                    x_index);
 
             SET_CR_ZERO
@@ -3482,7 +3507,7 @@ static void testfunction_vector_scalar_rounding_quads (const char* instruction_n
 
          printf("%s %016lx%016lx (R=%x) (RMC=%x) => ",
                 instruction_name,
-                vec_xb[1], vec_xb[0],
+                (unsigned long)vec_xb[1], (unsigned long)vec_xb[0],
                 (x_index & 0x4) >> 2, x_index & 0x3);
 
          SET_CR_ZERO
@@ -3492,7 +3517,8 @@ static void testfunction_vector_scalar_rounding_quads (const char* instruction_n
 
          GET_FPSCR(local_fpscr);
 
-         printf("%016lx%016lx", vec_xt[1], vec_xt[0]);
+         printf("%016lx%016lx", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0]);
          dissect_fpscr(local_fpscr);
          printf("\n");
       }
@@ -3525,15 +3551,16 @@ static void testfunction_vector_three_special (const char* instruction_name,
             SET_FPSCR_ZERO;
             printf("%s %016lx%016lx %016lx%016lx %016lx%016lx => ",
                    instruction_name,
-                   vec_xa[1], vec_xa[0],
-                   vec_xb[1], vec_xb[0],
-                   vec_xt[1], vec_xt[0]);
+                   (unsigned long)vec_xa[1], (unsigned long)vec_xa[0],
+                   (unsigned long)vec_xb[1], (unsigned long)vec_xb[0],
+                   (unsigned long)vec_xt[1], (unsigned long)vec_xt[0]);
 
             (*test_function)();
 
             GET_FPSCR(local_fpscr);
 
-            printf(" %016lx%016lx", vec_xt[1], vec_xt[0]);
+            printf(" %016lx%016lx", (unsigned long)vec_xt[1],
+                   (unsigned long)vec_xt[0]);
             dissect_fpscr(local_fpscr);
             printf("\n");
          }
@@ -3579,7 +3606,7 @@ static void testfunction_vector_scalar_two_double(const char* instruction_name,
                binary16_float_vsxargs[(nb_float_vsxargs - 1) - i ] << 48
             };
             printf("   vec_xb[1] = 0x%lx, vec_xb[0] = 0x%lx ",
-                   vec_xb[1], vec_xb[0]);
+                   (unsigned long)vec_xb[1], (unsigned long)vec_xb[0]);
 
          } else if (uses_single_precision_input(instruction_name)) {
             vec_xb = (vector unsigned long) {
@@ -3589,7 +3616,7 @@ static void testfunction_vector_scalar_two_double(const char* instruction_name,
                binary32_float_vsxargs[nb_float_vsxargs - 1 - j ] << 32
             };
             printf("   vec_xb[1] = 0x%lx, vec_xb[0] = 0x%lx ",
-                   vec_xb[1], vec_xb[0]);
+                   (unsigned long)vec_xb[1], (unsigned long)vec_xb[0]);
 
          } else { /* uses double */
             r14 = binary64_float_vsxargs[i];
@@ -3599,7 +3626,8 @@ static void testfunction_vector_scalar_two_double(const char* instruction_name,
 
          vec_xt = (vector unsigned long){0, 0};
 
-         printf("%016lx %016lx ", vec_xb[1], vec_xb[0] );
+         printf("%016lx %016lx ", (unsigned long)vec_xb[1],
+                (unsigned long)vec_xb[0] );
 
          if ((verbose > 2) && uses_double_precision_input(instruction_name)) {
             dissect_binary64_float(vec_xb[1]);
@@ -3612,7 +3640,8 @@ static void testfunction_vector_scalar_two_double(const char* instruction_name,
         (*test_function)();
 
          GET_FPSCR(local_fpscr);
-         printf(" %016lx %016lx", vec_xt[1], vec_xt[0]);
+         printf(" %016lx %016lx", (unsigned long)vec_xt[1],
+                (unsigned long)vec_xt[0]);
 
          if ((verbose > 2) && uses_half_precision_output(instruction_name)) {
             dissect_double_as_16s(vec_xt[1]);
@@ -3834,12 +3863,14 @@ static void testfunction_bcd_misc (const char* instruction_name,
          if (short_circuit) continue;
 
          printf("%s ",  instruction_name);
-         printf("xa:%016lx %016lx ", vec_xa[1], vec_xa[0]);
+         printf("xa:%016lx %016lx ", (unsigned long)vec_xa[1],
+                (unsigned long)vec_xa[0]);
 
          if (!shift_or_truncate_instruction)
             dissect_packed_decimal_sign(xa_sign);
 
-         printf(" xb:%016lx %016lx ", vec_xb[1], vec_xb[0]);
+         printf(" xb:%016lx %016lx ", (unsigned long)vec_xb[1],
+                (unsigned long)vec_xb[0]);
 
          if (convert_from_zoned(instruction_name)) {
             /* convert from zoned */